From 18f4e1a2b7f54da3bb661770f8cb3cc9402e974b Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 4 Sep 2018 06:26:28 -0400 Subject: Remove aspectlib debugging --- coverage/debug.py | 37 ------------------------------------- 1 file changed, 37 deletions(-) (limited to 'coverage/debug.py') 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) -- cgit v1.2.1