Skip to content

Commit 18f4e1a

Browse files
committed
Remove aspectlib debugging
1 parent 1ed59dd commit 18f4e1a

File tree

2 files changed

+1
-38
lines changed

2 files changed

+1
-38
lines changed

coverage/control.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ def plugin_info(plugins):
870870

871871

872872
# Mega debugging...
873-
if int(os.environ.get("COVERAGE_DEBUG_CALLS", 0)):
873+
if int(os.environ.get("COVERAGE_DEBUG_CALLS", 0)): # pragma: debugging
874874
from coverage.debug import decorate_methods, show_calls
875875

876876
Coverage = decorate_methods(show_calls(show_args=True), butnot=['get_data'])(Coverage)

coverage/debug.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -352,40 +352,3 @@ def _clean_stack_line(s): # pragma: debugging
352352
s = s.replace(os.path.dirname(os.__file__) + '/', '')
353353
s = s.replace(sys.prefix + '/', '')
354354
return s
355-
356-
357-
def filter_aspectlib_frames(text): # pragma: debugging
358-
"""Aspectlib prints stack traces, but includes its own frames. Scrub those out."""
359-
# <<< aspectlib/__init__.py:257:function_wrapper < igor.py:143:run_tests < ...
360-
text = re.sub(r"(?<= )aspectlib/[^.]+\.py:\d+:\w+ < ", "", text)
361-
return text
362-
363-
364-
def enable_aspectlib_maybe(): # pragma: debugging
365-
"""For debugging, we can use aspectlib to trace execution.
366-
367-
Define COVERAGE_ASPECTLIB to enable and configure aspectlib to trace
368-
execution::
369-
370-
$ export COVERAGE_ASPECTLIB=coverage.Coverage:coverage.data.CoverageData
371-
$ coverage run blah.py ...
372-
373-
This will trace all the public methods on Coverage and CoverageData,
374-
writing the information to covaspect.txt.
375-
376-
"""
377-
aspects = os.environ.get("COVERAGE_ASPECTLIB", "")
378-
if not aspects:
379-
return
380-
381-
import aspectlib # pylint: disable=import-error
382-
import aspectlib.debug # pylint: disable=import-error
383-
384-
filters = [add_pid_and_tid, filter_aspectlib_frames]
385-
aspects_file = DebugOutputFile.get_one(None, show_process=True, filters=filters)
386-
aspect_log = aspectlib.debug.log(
387-
print_to=aspects_file, attributes=['id'], stacktrace=30, use_logging=False
388-
)
389-
public_methods = re.compile(r'^(__init__|[a-zA-Z].*)$')
390-
for aspect in aspects.split(':'):
391-
aspectlib.weave(aspect, aspect_log, methods=public_methods)

0 commit comments

Comments
 (0)