diff options
Diffstat (limited to 'Lib/test/test_trace.py')
-rw-r--r-- | Lib/test/test_trace.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/test/test_trace.py b/Lib/test/test_trace.py index ee33986..03dff84 100644 --- a/Lib/test/test_trace.py +++ b/Lib/test/test_trace.py @@ -9,12 +9,11 @@ from trace import CoverageResults, Trace from test.tracedmodules import testmod - #------------------------------- Utilities -----------------------------------# def fix_ext_py(filename): - """Given a .pyc/.pyo filename converts it to the appropriate .py""" - if filename.endswith(('.pyc', '.pyo')): + """Given a .pyc filename converts it to the appropriate .py""" + if filename.endswith('.pyc'): filename = filename[:-1] return filename @@ -223,6 +222,11 @@ class TestFuncs(unittest.TestCase): self.addCleanup(sys.settrace, sys.gettrace()) self.tracer = Trace(count=0, trace=0, countfuncs=1) self.filemod = my_file_and_modname() + self._saved_tracefunc = sys.gettrace() + + def tearDown(self): + if self._saved_tracefunc is not None: + sys.settrace(self._saved_tracefunc) def test_simple_caller(self): self.tracer.runfunc(traced_func_simple_caller, 1) |