Skip to content

Commit 19758b1

Browse files
committed
moved builtin Exceptions to builtins module
1 parent 5484d97 commit 19758b1

186 files changed

Lines changed: 242 additions & 912 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Lib/test/support/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,21 @@ def check_impl_detail(**guards):
12311231
return guards.get(platform.python_implementation().lower(), default)
12321232

12331233

1234+
def no_tracing(func):
1235+
"""Decorator to temporarily turn off tracing for the duration of a test."""
1236+
if not hasattr(sys, 'gettrace'):
1237+
return func
1238+
else:
1239+
@functools.wraps(func)
1240+
def wrapper(*args, **kwargs):
1241+
original_trace = sys.gettrace()
1242+
try:
1243+
sys.settrace(None)
1244+
return func(*args, **kwargs)
1245+
finally:
1246+
sys.settrace(original_trace)
1247+
return wrapper
1248+
12341249

12351250
def _run_suite(suite):
12361251
"""Run tests from a unittest.TestSuite-derived class."""

0 commit comments

Comments
 (0)