MCPcopy Index your code
hub / github.com/python/cpython / no_tracing

Function no_tracing

Lib/test/support/__init__.py:1386–1411  ·  view source on GitHub ↗

Decorator to temporarily turn off tracing for the duration of a test.

(func)

Source from the content-addressed store, hash-verified

1384
1385
1386def no_tracing(func):
1387 """Decorator to temporarily turn off tracing for the duration of a test."""
1388 trace_wrapper = func
1389 if hasattr(sys, 'gettrace'):
1390 @functools.wraps(func)
1391 def trace_wrapper(*args, **kwargs):
1392 original_trace = sys.gettrace()
1393 try:
1394 sys.settrace(None)
1395 return func(*args, **kwargs)
1396 finally:
1397 sys.settrace(original_trace)
1398
1399 coverage_wrapper = trace_wrapper
1400 if 'test.cov' in sys.modules: # -Xpresite=test.cov used
1401 cov = sys.monitoring.COVERAGE_ID
1402 @functools.wraps(func)
1403 def coverage_wrapper(*args, **kwargs):
1404 original_events = sys.monitoring.get_events(cov)
1405 try:
1406 sys.monitoring.set_events(cov, 0)
1407 return trace_wrapper(*args, **kwargs)
1408 finally:
1409 sys.monitoring.set_events(cov, original_events)
1410
1411 return coverage_wrapper
1412
1413
1414def no_rerun(reason):

Callers 1

refcount_testFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…