Skip to content

Commit 490c542

Browse files
authored
bpo-40275: Fix failed test cases by using test helpers (GH-21811)
1 parent a02efe4 commit 490c542

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

Lib/test/test__osx_support.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import sys
99
import unittest
1010

11-
import test.support
1211
from test.support import os_helper
1312

1413
import _osx_support
@@ -20,7 +19,7 @@ def setUp(self):
2019
self.maxDiff = None
2120
self.prog_name = 'bogus_program_xxxx'
2221
self.temp_path_dir = os.path.abspath(os.getcwd())
23-
self.env = test.support.EnvironmentVarGuard()
22+
self.env = os_helper.EnvironmentVarGuard()
2423
self.addCleanup(self.env.__exit__)
2524
for cv in ('CFLAGS', 'LDFLAGS', 'CPPFLAGS',
2625
'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'CC',

Lib/test/test_importlib/extension/test_case_sensitivity.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from importlib import _bootstrap_external
2-
from test import support
2+
from test.support import os_helper
33
import unittest
44
import sys
55
from .. import util
@@ -23,15 +23,15 @@ def find_module(self):
2323

2424
@unittest.skipIf(sys.flags.ignore_environment, 'ignore_environment flag was set')
2525
def test_case_sensitive(self):
26-
with support.EnvironmentVarGuard() as env:
26+
with os_helper.EnvironmentVarGuard() as env:
2727
env.unset('PYTHONCASEOK')
2828
self.caseok_env_changed(should_exist=False)
2929
loader = self.find_module()
3030
self.assertIsNone(loader)
3131

3232
@unittest.skipIf(sys.flags.ignore_environment, 'ignore_environment flag was set')
3333
def test_case_insensitivity(self):
34-
with support.EnvironmentVarGuard() as env:
34+
with os_helper.EnvironmentVarGuard() as env:
3535
env.set('PYTHONCASEOK', '1')
3636
self.caseok_env_changed(should_exist=True)
3737
loader = self.find_module()

Lib/test/test_importlib/source/test_case_sensitivity.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
machinery = util.import_importlib('importlib.machinery')
88

99
import os
10-
from test import support as test_support
10+
from test.support import os_helper
1111
import unittest
1212

1313

@@ -42,7 +42,7 @@ def sensitivity_test(self):
4242

4343
@unittest.skipIf(sys.flags.ignore_environment, 'ignore_environment flag was set')
4444
def test_sensitive(self):
45-
with test_support.EnvironmentVarGuard() as env:
45+
with os_helper.EnvironmentVarGuard() as env:
4646
env.unset('PYTHONCASEOK')
4747
self.caseok_env_changed(should_exist=False)
4848
sensitive, insensitive = self.sensitivity_test()
@@ -52,7 +52,7 @@ def test_sensitive(self):
5252

5353
@unittest.skipIf(sys.flags.ignore_environment, 'ignore_environment flag was set')
5454
def test_insensitive(self):
55-
with test_support.EnvironmentVarGuard() as env:
55+
with os_helper.EnvironmentVarGuard() as env:
5656
env.set('PYTHONCASEOK', '1')
5757
self.caseok_env_changed(should_exist=True)
5858
sensitive, insensitive = self.sensitivity_test()

Lib/test/test_selectors.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import socket
77
import sys
88
from test import support
9+
from test.support import os_helper
910
from test.support import socket_helper
1011
from time import sleep
1112
import unittest
@@ -536,7 +537,7 @@ def test_register_bad_fd(self):
536537
# a file descriptor that's been closed should raise an OSError
537538
# with EBADF
538539
s = self.SELECTOR()
539-
bad_f = support.make_bad_fd()
540+
bad_f = os_helper.make_bad_fd()
540541
with self.assertRaises(OSError) as cm:
541542
s.register(bad_f, selectors.EVENT_READ)
542543
self.assertEqual(cm.exception.errno, errno.EBADF)

0 commit comments

Comments
 (0)