diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2018-09-04 06:26:28 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2018-09-04 06:26:28 -0400 |
commit | 18f4e1a2b7f54da3bb661770f8cb3cc9402e974b (patch) | |
tree | 306d35342d9ec7e9f79594c2a0284d64d0cd8f21 | |
parent | 1ed59ddc5f8fef4b4446ba51408b561aa0e0f99a (diff) | |
download | python-coveragepy-git-18f4e1a2b7f54da3bb661770f8cb3cc9402e974b.tar.gz |
Remove aspectlib debugging
-rw-r--r-- | coverage/control.py | 2 | ||||
-rw-r--r-- | coverage/debug.py | 37 |
2 files changed, 1 insertions, 38 deletions
diff --git a/coverage/control.py b/coverage/control.py index c4022f1f..08d21959 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -870,7 +870,7 @@ class Coverage(object): # Mega debugging... -if int(os.environ.get("COVERAGE_DEBUG_CALLS", 0)): +if int(os.environ.get("COVERAGE_DEBUG_CALLS", 0)): # pragma: debugging from coverage.debug import decorate_methods, show_calls Coverage = decorate_methods(show_calls(show_args=True), butnot=['get_data'])(Coverage) diff --git a/coverage/debug.py b/coverage/debug.py index c2d7b517..f990ca3b 100644 --- a/coverage/debug.py +++ b/coverage/debug.py @@ -352,40 +352,3 @@ def _clean_stack_line(s): # pragma: debugging s = s.replace(os.path.dirname(os.__file__) + '/', '') s = s.replace(sys.prefix + '/', '') return s - - -def filter_aspectlib_frames(text): # pragma: debugging - """Aspectlib prints stack traces, but includes its own frames. Scrub those out.""" - # <<< aspectlib/__init__.py:257:function_wrapper < igor.py:143:run_tests < ... - text = re.sub(r"(?<= )aspectlib/[^.]+\.py:\d+:\w+ < ", "", text) - return text - - -def enable_aspectlib_maybe(): # pragma: debugging - """For debugging, we can use aspectlib to trace execution. - - Define COVERAGE_ASPECTLIB to enable and configure aspectlib to trace - execution:: - - $ export COVERAGE_ASPECTLIB=coverage.Coverage:coverage.data.CoverageData - $ coverage run blah.py ... - - This will trace all the public methods on Coverage and CoverageData, - writing the information to covaspect.txt. - - """ - aspects = os.environ.get("COVERAGE_ASPECTLIB", "") - if not aspects: - return - - import aspectlib # pylint: disable=import-error - import aspectlib.debug # pylint: disable=import-error - - filters = [add_pid_and_tid, filter_aspectlib_frames] - aspects_file = DebugOutputFile.get_one(None, show_process=True, filters=filters) - aspect_log = aspectlib.debug.log( - print_to=aspects_file, attributes=['id'], stacktrace=30, use_logging=False - ) - public_methods = re.compile(r'^(__init__|[a-zA-Z].*)$') - for aspect in aspects.split(':'): - aspectlib.weave(aspect, aspect_log, methods=public_methods) |