summaryrefslogtreecommitdiff
path: root/Lib/test/test_trace.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2015-09-08 00:36:56 -0400
committerRaymond Hettinger <python@rcn.com>2015-09-08 00:36:56 -0400
commit6a97f4d4add4a048b03db0576a3da6522a02e176 (patch)
treea0eb3c2cf7546b895a6f47b5e6b9404a6cc45b62 /Lib/test/test_trace.py
parentba1b338c7060bb018ad015964d7da94621fc18ca (diff)
parenta505c27518b3bc7e2c088dd7d4db802956e1155d (diff)
downloadcpython-6a97f4d4add4a048b03db0576a3da6522a02e176.tar.gz
merge
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 ee3398621b..03dff8432d 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)