]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40275: Fix failed test cases by using test helpers (GH-21811)
authorHai Shi <shihai1992@gmail.com>
Mon, 10 Aug 2020 21:24:02 +0000 (05:24 +0800)
committerGitHub <noreply@github.com>
Mon, 10 Aug 2020 21:24:02 +0000 (23:24 +0200)
Lib/test/test__osx_support.py
Lib/test/test_importlib/extension/test_case_sensitivity.py
Lib/test/test_importlib/source/test_case_sensitivity.py
Lib/test/test_selectors.py

index a3f41d2c5bd075f4dbf301d38751e45b7d33801a..907ae27d529b502320f3d0fef1e1beac55245e6f 100644 (file)
@@ -8,7 +8,6 @@ import stat
 import sys
 import unittest
 
-import test.support
 from test.support import os_helper
 
 import _osx_support
@@ -20,7 +19,7 @@ class Test_OSXSupport(unittest.TestCase):
         self.maxDiff = None
         self.prog_name = 'bogus_program_xxxx'
         self.temp_path_dir = os.path.abspath(os.getcwd())
-        self.env = test.support.EnvironmentVarGuard()
+        self.env = os_helper.EnvironmentVarGuard()
         self.addCleanup(self.env.__exit__)
         for cv in ('CFLAGS', 'LDFLAGS', 'CPPFLAGS',
                             'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'CC',
index 3a857847381a9a53529b2d4995b302cd8e7e5626..4d76fa014cd73b403d40d2510cc67df78338ce6d 100644 (file)
@@ -1,5 +1,5 @@
 from importlib import _bootstrap_external
-from test import support
+from test.support import os_helper
 import unittest
 import sys
 from .. import util
@@ -23,7 +23,7 @@ class ExtensionModuleCaseSensitivityTest(util.CASEOKTestBase):
 
     @unittest.skipIf(sys.flags.ignore_environment, 'ignore_environment flag was set')
     def test_case_sensitive(self):
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env.unset('PYTHONCASEOK')
             self.caseok_env_changed(should_exist=False)
             loader = self.find_module()
@@ -31,7 +31,7 @@ class ExtensionModuleCaseSensitivityTest(util.CASEOKTestBase):
 
     @unittest.skipIf(sys.flags.ignore_environment, 'ignore_environment flag was set')
     def test_case_insensitivity(self):
-        with support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env.set('PYTHONCASEOK', '1')
             self.caseok_env_changed(should_exist=True)
             loader = self.find_module()
index ad1cfdb7e5cc1a68cdc11ca008683d69ba8eff39..77c06a75fc77be946d24f865cdfafbc13faef977 100644 (file)
@@ -7,7 +7,7 @@ importlib = util.import_importlib('importlib')
 machinery = util.import_importlib('importlib.machinery')
 
 import os
-from test import support as test_support
+from test.support import os_helper
 import unittest
 
 
@@ -42,7 +42,7 @@ class CaseSensitivityTest(util.CASEOKTestBase):
 
     @unittest.skipIf(sys.flags.ignore_environment, 'ignore_environment flag was set')
     def test_sensitive(self):
-        with test_support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env.unset('PYTHONCASEOK')
             self.caseok_env_changed(should_exist=False)
             sensitive, insensitive = self.sensitivity_test()
@@ -52,7 +52,7 @@ class CaseSensitivityTest(util.CASEOKTestBase):
 
     @unittest.skipIf(sys.flags.ignore_environment, 'ignore_environment flag was set')
     def test_insensitive(self):
-        with test_support.EnvironmentVarGuard() as env:
+        with os_helper.EnvironmentVarGuard() as env:
             env.set('PYTHONCASEOK', '1')
             self.caseok_env_changed(should_exist=True)
             sensitive, insensitive = self.sensitivity_test()
index 2274c39a79a5327106032ef5ad381fb86bf02a7d..851b1fc1b9e0c49f055215be10d759713033b24f 100644 (file)
@@ -6,6 +6,7 @@ import signal
 import socket
 import sys
 from test import support
+from test.support import os_helper
 from test.support import socket_helper
 from time import sleep
 import unittest
@@ -536,7 +537,7 @@ class KqueueSelectorTestCase(BaseSelectorTestCase, ScalableSelectorMixIn):
         # a file descriptor that's been closed should raise an OSError
         # with EBADF
         s = self.SELECTOR()
-        bad_f = support.make_bad_fd()
+        bad_f = os_helper.make_bad_fd()
         with self.assertRaises(OSError) as cm:
             s.register(bad_f, selectors.EVENT_READ)
         self.assertEqual(cm.exception.errno, errno.EBADF)