Index: Lib/test/test_frozen.py =================================================================== --- Lib/test/test_frozen.py (Revision 58916) +++ Lib/test/test_frozen.py (Arbeitskopie) @@ -4,10 +4,17 @@ from test.test_support import captured_stdout, run_unittest import unittest import sys, os +import warnings class FrozenTests(unittest.TestCase): def test_frozen(self): - + # multiple runs during a test session fail (e.g. a refleak check) + # because the tests depend on some output during the import of + # modules. + if "__hello__" in sys.modules: + warnings.warn("multiple runs of test_frozen lead false errors", + RuntimeWarning) + return with captured_stdout() as stdout: try: import __hello__ Index: Lib/test/test_pkg.py =================================================================== --- Lib/test/test_pkg.py (Revision 58916) +++ Lib/test/test_pkg.py (Arbeitskopie) @@ -6,6 +6,7 @@ import textwrap import traceback import unittest +import warnings from test import test_support @@ -51,7 +52,8 @@ def tearDown(self): sys.path[:] = self.syspath - cleanout(self.root) + if self.root is not None: + cleanout(self.root) def run_code(self, code): exec(textwrap.dedent(code), globals(), {"self": self}) @@ -195,6 +197,11 @@ ['__doc__', '__file__', '__name__', 'spam']) def test_6(self): + # multiple runs during a test session fail + if "t6" in sys.modules: + warnings.warn("multiple runs of test_6 lead false errors", + RuntimeWarning) + return hier = [ ("t6", None), ("t6 __init__.py", @@ -221,6 +228,11 @@ self.run_code(s) def test_7(self): + # multiple runs during a test session fail + if "t7" in sys.modules: + warnings.warn("multiple runs of test_7 lead false errors", + RuntimeWarning) + return hier = [ ("t7.py", ""), ("t7", None), Index: Lib/test/test_tcl.py =================================================================== --- Lib/test/test_tcl.py (Revision 58916) +++ Lib/test/test_tcl.py (Arbeitskopie) @@ -2,11 +2,13 @@ import unittest import os +import sys from test import test_support from Tkinter import Tcl from _tkinter import TclError class TclTest(unittest.TestCase): + tk_loaded = False def setUp(self): self.interp = Tcl() @@ -120,16 +122,20 @@ if 'DISPLAY' not in os.environ: # skipping test of clean upgradeability return + if "TKLOADED" in os.environ: + # workaround for problem when this test runs multiple times in a + # row during refleak test. + # Calling Tk_Init again after a previous call failed might deadlock + return tcl = Tcl() self.assertRaises(TclError,tcl.winfo_geometry) tcl.loadtk() + os.environ["TKLOADED"] = "yes" self.assertEqual('1x1+0+0', tcl.winfo_geometry()) tcl.destroy() def testLoadTkFailure(self): - import os old_display = None - import sys if sys.platform.startswith(('win', 'darwin', 'cygwin')): return # no failure possible on windows? if 'DISPLAY' in os.environ: