1"""
2Base functionality for Pympler tests.
3"""
4
5import sys
6
7
8def disable(func):
9    """
10    Decorator to deactivate a test method.
11    The test is still run if the test module is invoked directly.
12    """
13
14    def _exclude(self, *args, **kwargs):
15        if 'runtest.py' in sys.argv[0]:
16            sys.stderr.write("(disabled) ")
17        else:
18            func(self, *args, **kwargs)
19
20    return _exclude
21