]> granicus.if.org Git - python/commitdiff
bpo-30813: Fix unittest when hunting refleaks (#2502) (#2505)
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 30 Jun 2017 11:12:20 +0000 (13:12 +0200)
committerGitHub <noreply@github.com>
Fri, 30 Jun 2017 11:12:20 +0000 (13:12 +0200)
bpo-11798, bpo-16662, bpo-16935, bpo-30813: Skip
test_discover_with_module_that_raises_SkipTest_on_import() and
test_discover_with_init_module_that_raises_SkipTest_on_import() of
test_unittest when hunting reference leaks using regrtest.
(cherry picked from commit e4f9a2d2be42d5a2cdd624f8ed7cdf5028c5fbc3)

Lib/unittest/test/test_discovery.py

index 1996a8ee5d3680a0951583dfafeeb90dcce26c8a..48d8fe95bce2616873d959156b85b75ef92770d5 100644 (file)
@@ -528,6 +528,9 @@ class TestDiscovery(unittest.TestCase):
             pickle.loads(pickle.dumps(test, proto))
 
     def test_discover_with_module_that_raises_SkipTest_on_import(self):
+        if not unittest.BaseTestSuite._cleanup:
+            raise unittest.SkipTest("Suite cleanup is disabled")
+
         loader = unittest.TestLoader()
 
         def _get_module_from_name(name):
@@ -548,6 +551,9 @@ class TestDiscovery(unittest.TestCase):
             pickle.loads(pickle.dumps(suite, proto))
 
     def test_discover_with_init_module_that_raises_SkipTest_on_import(self):
+        if not unittest.BaseTestSuite._cleanup:
+            raise unittest.SkipTest("Suite cleanup is disabled")
+
         vfs = {abspath('/foo'): ['my_package'],
                abspath('/foo/my_package'): ['__init__.py', 'test_module.py']}
         self.setup_import_issue_package_tests(vfs)