aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_runpy.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2011-02-21 19:29:56 +0000
committerBrett Cannon <bcannon@gmail.com>2011-02-21 19:29:56 +0000
commit31f5929c1e28adcaa1fdb302da366f3c7a92a98a (patch)
tree5035df0c8c20111fb27a4940e38401f244bc9854 /Lib/test/test_runpy.py
parent4709ec0686ba85466a293b85a243979882696240 (diff)
downloadcpython-31f5929c1e28adcaa1fdb302da366f3c7a92a98a.tar.gz
cpython-31f5929c1e28adcaa1fdb302da366f3c7a92a98a.zip
Issue #10990: Prevent tests from clobbering a set trace function.
Many tests simply didn't care if they unset a pre-existing trace function. This made test coverage impossible. This patch fixes various tests to put back any pre-existing trace function. It also introduces test.support.no_tracing as a decorator which will temporarily unset the trace function for tests which simply fail otherwise. Thanks to Kristian Vlaardingerbroek for helping to find the cause of various trace function unsets.
Diffstat (limited to 'Lib/test/test_runpy.py')
-rw-r--r--Lib/test/test_runpy.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py
index ad3ab397f49..00f34b18248 100644
--- a/Lib/test/test_runpy.py
+++ b/Lib/test/test_runpy.py
@@ -6,7 +6,8 @@ import sys
import re
import tempfile
import py_compile
-from test.support import forget, make_legacy_pyc, run_unittest, unload, verbose
+from test.support import (
+ forget, make_legacy_pyc, run_unittest, unload, verbose, no_tracing)
from test.script_helper import (
make_pkg, make_script, make_zip_pkg, make_zip_script, temp_dir)
@@ -395,6 +396,7 @@ argv0 = sys.argv[0]
msg = "can't find '__main__' module in %r" % zip_name
self._check_import_error(zip_name, msg)
+ @no_tracing
def test_main_recursion_error(self):
with temp_dir() as script_dir, temp_dir() as dummy_dir:
mod_name = '__main__'