Skip to content

bpo-40275: Fix failed test cases by using test helpers #21811

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Lib/test/test__osx_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import sys
import unittest

import test.support
from test.support import os_helper

import _osx_support
Expand All @@ -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',
Expand Down
6 changes: 3 additions & 3 deletions Lib/test/test_importlib/extension/test_case_sensitivity.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -23,15 +23,15 @@ 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()
self.assertIsNone(loader)

@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()
Expand Down
6 changes: 3 additions & 3 deletions Lib/test/test_importlib/source/test_case_sensitivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion Lib/test/test_selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down