@@ -352,40 +352,3 @@ def _clean_stack_line(s): # pragma: debugging
352
352
s = s .replace (os .path .dirname (os .__file__ ) + '/' , '' )
353
353
s = s .replace (sys .prefix + '/' , '' )
354
354
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