[Python-checkins] bpo-40275: Fix failed test cases by using test helpers (GH-21811)
Hai Shi
webhook-mailer at python.org
Mon Aug 10 17:24:12 EDT 2020
https://github.com/python/cpython/commit/490c5426b1b23831d83d0c6b269858fb98450889
commit: 490c5426b1b23831d83d0c6b269858fb98450889
branch: master
author: Hai Shi <shihai1992 at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-08-10T23:24:02+02:00
summary:
bpo-40275: Fix failed test cases by using test helpers (GH-21811)
files:
M Lib/test/test__osx_support.py
M Lib/test/test_importlib/extension/test_case_sensitivity.py
M Lib/test/test_importlib/source/test_case_sensitivity.py
M Lib/test/test_selectors.py
diff --git a/Lib/test/test__osx_support.py b/Lib/test/test__osx_support.py
index a3f41d2c5bd07..907ae27d529b5 100644
--- a/Lib/test/test__osx_support.py
+++ b/Lib/test/test__osx_support.py
@@ -8,7 +8,6 @@
import sys
import unittest
-import test.support
from test.support import os_helper
import _osx_support
@@ -20,7 +19,7 @@ def setUp(self):
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',
diff --git a/Lib/test/test_importlib/extension/test_case_sensitivity.py b/Lib/test/test_importlib/extension/test_case_sensitivity.py
index 3a857847381a9..4d76fa014cd73 100644
--- a/Lib/test/test_importlib/extension/test_case_sensitivity.py
+++ b/Lib/test/test_importlib/extension/test_case_sensitivity.py
@@ -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 @@ def find_module(self):
@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 @@ def test_case_sensitive(self):
@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()
diff --git a/Lib/test/test_importlib/source/test_case_sensitivity.py b/Lib/test/test_importlib/source/test_case_sensitivity.py
index ad1cfdb7e5cc1..77c06a75fc77b 100644
--- a/Lib/test/test_importlib/source/test_case_sensitivity.py
+++ b/Lib/test/test_importlib/source/test_case_sensitivity.py
@@ -7,7 +7,7 @@
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 @@ def sensitivity_test(self):
@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 @@ def test_sensitive(self):
@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()
diff --git a/Lib/test/test_selectors.py b/Lib/test/test_selectors.py
index 2274c39a79a53..851b1fc1b9e0c 100644
--- a/Lib/test/test_selectors.py
+++ b/Lib/test/test_selectors.py
@@ -6,6 +6,7 @@
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 @@ def test_register_bad_fd(self):
# 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)
More information about the Python-checkins
mailing list