diff options
author | Hai Shi <shihai1992@gmail.com> | 2020-08-03 16:41:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-03 16:41:24 (GMT) |
commit | a7f5d93bb6906d0f999248b47295d3a59b130f4d (patch) | |
tree | a0dc5043ecc7a4250902f8d14c802382b1c94b8a /Lib/unittest/test | |
parent | 488512bf4953d856fcb049a05060a450af52fcdc (diff) | |
download | cpython-a7f5d93bb6906d0f999248b47295d3a59b130f4d.zip cpython-a7f5d93bb6906d0f999248b47295d3a59b130f4d.tar.gz cpython-a7f5d93bb6906d0f999248b47295d3a59b130f4d.tar.bz2 |
bpo-40275: Use new test.support helper submodules in tests (GH-21449)
Diffstat (limited to 'Lib/unittest/test')
-rw-r--r-- | Lib/unittest/test/test_discovery.py | 5 | ||||
-rw-r--r-- | Lib/unittest/test/test_result.py | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/Lib/unittest/test/test_discovery.py b/Lib/unittest/test/test_discovery.py index 16e081e..9d502c5 100644 --- a/Lib/unittest/test/test_discovery.py +++ b/Lib/unittest/test/test_discovery.py @@ -5,6 +5,7 @@ import sys import types import pickle from test import support +from test.support import import_helper import test.test_importlib.util import unittest @@ -848,7 +849,7 @@ class TestDiscovery(unittest.TestCase): with unittest.mock.patch('builtins.__import__', _import): # Since loader.discover() can modify sys.path, restore it when done. - with support.DirsOnSysPath(): + with import_helper.DirsOnSysPath(): # Make sure to remove 'package' from sys.modules when done. with test.test_importlib.util.uncache('package'): suite = loader.discover('package') @@ -865,7 +866,7 @@ class TestDiscovery(unittest.TestCase): with unittest.mock.patch('builtins.__import__', _import): # Since loader.discover() can modify sys.path, restore it when done. - with support.DirsOnSysPath(): + with import_helper.DirsOnSysPath(): # Make sure to remove 'package' from sys.modules when done. with test.test_importlib.util.uncache('package'): with self.assertRaises(TypeError) as cm: diff --git a/Lib/unittest/test/test_result.py b/Lib/unittest/test/test_result.py index 0ffb87b..a4af67b 100644 --- a/Lib/unittest/test/test_result.py +++ b/Lib/unittest/test/test_result.py @@ -2,7 +2,7 @@ import io import sys import textwrap -from test import support +from test.support import warnings_helper import traceback import unittest @@ -458,8 +458,8 @@ OldResult = type('OldResult', (object,), classDict) class Test_OldTestResult(unittest.TestCase): def assertOldResultWarning(self, test, failures): - with support.check_warnings(("TestResult has no add.+ method,", - RuntimeWarning)): + with warnings_helper.check_warnings( + ("TestResult has no add.+ method,", RuntimeWarning)): result = OldResult() test.run(result) self.assertEqual(len(result.failures), failures) |