summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_trace.py
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2014-06-29 21:44:05 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2014-06-29 21:44:05 (GMT)
commitf026dae130bf6f9015c4b212f16852ba4a3f3dec (patch)
treef3cef557d7c98cf965688901d63bb2d3cd705b8d /Lib/test/test_trace.py
parent15c6ed52390cade3b070bf4b7097cb1d121d9dac (diff)
downloadcpython-f026dae130bf6f9015c4b212f16852ba4a3f3dec.zip
cpython-f026dae130bf6f9015c4b212f16852ba4a3f3dec.tar.gz
cpython-f026dae130bf6f9015c4b212f16852ba4a3f3dec.tar.bz2
Fixes #10541: regrtest -T is broken
* makes test_trace tests restore the tracefunc after they run * write_results() in trace module will not terminate if lnotab cannot be found.
Diffstat (limited to 'Lib/test/test_trace.py')
-rw-r--r--Lib/test/test_trace.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_trace.py b/Lib/test/test_trace.py
index 1cec710..05bf274 100644
--- a/Lib/test/test_trace.py
+++ b/Lib/test/test_trace.py
@@ -10,7 +10,6 @@ from trace import CoverageResults, Trace
from test.tracedmodules import testmod
-
#------------------------------- Utilities -----------------------------------#
def fix_ext_py(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)