mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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.
This commit is contained in:
parent
4709ec0686
commit
31f5929c1e
15 changed files with 283 additions and 221 deletions
|
@ -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__'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue