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:
Brett Cannon 2011-02-21 19:29:56 +00:00
parent 4709ec0686
commit 31f5929c1e
15 changed files with 283 additions and 221 deletions

View file

@ -5,7 +5,7 @@ import pickletools
import copyreg
from http.cookies import SimpleCookie
from test.support import TestFailed, TESTFN, run_with_locale
from test.support import TestFailed, TESTFN, run_with_locale, no_tracing
from pickle import bytes_types
@ -1002,6 +1002,7 @@ class AbstractPickleTests(unittest.TestCase):
y = self.loads(s)
self.assertEqual(y._reduce_called, 1)
@no_tracing
def test_bad_getattr(self):
x = BadGetattr()
for proto in 0, 1: