mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +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
|
@ -2214,6 +2214,7 @@ class TextIOWrapperTest(unittest.TestCase):
|
|||
with self.open(support.TESTFN, "w", errors="replace") as f:
|
||||
self.assertEqual(f.errors, "replace")
|
||||
|
||||
@support.no_tracing
|
||||
@unittest.skipUnless(threading, 'Threading required for this test.')
|
||||
def test_threads_write(self):
|
||||
# Issue6750: concurrent writes could duplicate data
|
||||
|
@ -2669,6 +2670,7 @@ class SignalsTest(unittest.TestCase):
|
|||
def test_interrupted_write_text(self):
|
||||
self.check_interrupted_write("xy", b"xy", mode="w", encoding="ascii")
|
||||
|
||||
@support.no_tracing
|
||||
def check_reentrant_write(self, data, **fdopen_kwargs):
|
||||
def on_alarm(*args):
|
||||
# Will be called reentrantly from the same thread
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue