summaryrefslogtreecommitdiff
path: root/Lib/test/test_trace.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_trace.py')
-rw-r--r--Lib/test/test_trace.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/test/test_trace.py b/Lib/test/test_trace.py
index 1cec710ee5..2f2c584a5c 100644
--- a/Lib/test/test_trace.py
+++ b/Lib/test/test_trace.py
@@ -10,12 +10,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
@@ -224,6 +223,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)