summaryrefslogtreecommitdiffstats
path: root/Lib/unittest
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-06-30 10:52:52 (GMT)
committerGitHub <noreply@github.com>2017-06-30 10:52:52 (GMT)
commite4f9a2d2be42d5a2cdd624f8ed7cdf5028c5fbc3 (patch)
tree231eaa41ca9f4c8f4db5eb9305f2efc9af433017 /Lib/unittest
parentb9030674624c181d6e9047cdb14ad65bb6c84c66 (diff)
downloadcpython-e4f9a2d2be42d5a2cdd624f8ed7cdf5028c5fbc3.zip
cpython-e4f9a2d2be42d5a2cdd624f8ed7cdf5028c5fbc3.tar.gz
cpython-e4f9a2d2be42d5a2cdd624f8ed7cdf5028c5fbc3.tar.bz2
bpo-30813: Fix unittest when hunting refleaks (#2502)
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.
Diffstat (limited to 'Lib/unittest')
-rw-r--r--Lib/unittest/test/test_discovery.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/unittest/test/test_discovery.py b/Lib/unittest/test/test_discovery.py
index 1996a8e..48d8fe9 100644
--- a/Lib/unittest/test/test_discovery.py
+++ b/Lib/unittest/test/test_discovery.py
@@ -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)