diff options
Diffstat (limited to 'coverage')
-rw-r--r-- | coverage/debug.py | 8 | ||||
-rw-r--r-- | coverage/misc.py | 9 |
2 files changed, 8 insertions, 9 deletions
diff --git a/coverage/debug.py b/coverage/debug.py index cf90f77a..9077a3af 100644 --- a/coverage/debug.py +++ b/coverage/debug.py @@ -303,12 +303,12 @@ def decorate_methods(decorator, butnot=()): # pragma: debugging def break_in_pudb(func): # pragma: debugging """A function decorator to stop in the debugger for each call.""" @functools.wraps(func) - def wrapper(*args, **kwargs): + def _wrapper(*args, **kwargs): import pudb # pylint: disable=import-error sys.stdout = sys.__stdout__ pudb.set_trace() return func(*args, **kwargs) - return wrapper + return _wrapper OBJ_IDS = itertools.count() @@ -319,7 +319,7 @@ def show_calls(show_args=True, show_stack=False): # pragma: debugging """A method decorator to debug-log each call to the function.""" def _decorator(func): @functools.wraps(func) - def wrapper(self, *args, **kwargs): + def _wrapper(self, *args, **kwargs): oid = getattr(self, OBJ_ID_ATTR, None) if oid is None: oid = "{:08d} {:04d}".format(os.getpid(), next(OBJ_IDS)) @@ -340,7 +340,7 @@ def show_calls(show_args=True, show_stack=False): # pragma: debugging msg = "{} {:04d} {}{}\n".format(oid, next(CALLS), func.__name__, extra) DebugOutputFile.get_one().write(msg) return func(self, *args, **kwargs) - return wrapper + return _wrapper return _decorator diff --git a/coverage/misc.py b/coverage/misc.py index 7b8fbb93..a923829d 100644 --- a/coverage/misc.py +++ b/coverage/misc.py @@ -70,11 +70,11 @@ if env.TESTING: """Ensure that only one of the argnames is non-None.""" def _decorator(func): argnameset = set(name.strip() for name in argnames.split(",")) - def _wrapped(*args, **kwargs): + def _wrapper(*args, **kwargs): vals = [kwargs.get(name) for name in argnameset] assert sum(val is not None for val in vals) == 1 return func(*args, **kwargs) - return _wrapped + return _wrapper return _decorator else: # pragma: not testing # We aren't using real PyContracts, so just define our decorators as @@ -149,13 +149,12 @@ def expensive(fn): if env.TESTING: attr = "_once_" + fn.__name__ - def _wrapped(self): - """Inner function that checks the cache.""" + def _wrapper(self): if hasattr(self, attr): raise AssertionError("Shouldn't have called %s more than once" % fn.__name__) setattr(self, attr, True) return fn(self) - return _wrapped + return _wrapper else: return fn # pragma: not testing |