summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2016-07-15 18:55:21 (GMT)
committerBrett Cannon <brett@python.org>2016-07-15 18:55:21 (GMT)
commitb3e73b30ff5a87c81ef69f3b19a486877ed7f0c2 (patch)
tree94dddbdb417f50a75af2eb858361c9712ddef0da /Lib/test/test_importlib
parent33ed881f791c4ee9888eb1df6871129a94f9e6ee (diff)
parenta47a7a5bf88c72d85f322f528381ebfa924072e9 (diff)
downloadcpython-b3e73b30ff5a87c81ef69f3b19a486877ed7f0c2.zip
cpython-b3e73b30ff5a87c81ef69f3b19a486877ed7f0c2.tar.gz
cpython-b3e73b30ff5a87c81ef69f3b19a486877ed7f0c2.tar.bz2
Merge for #27083
Diffstat (limited to 'Lib/test/test_importlib')
-rw-r--r--Lib/test/test_importlib/source/test_case_sensitivity.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/Lib/test/test_importlib/source/test_case_sensitivity.py b/Lib/test/test_importlib/source/test_case_sensitivity.py
index 0d6c388..aac820b 100644
--- a/Lib/test/test_importlib/source/test_case_sensitivity.py
+++ b/Lib/test/test_importlib/source/test_case_sensitivity.py
@@ -38,12 +38,17 @@ class CaseSensitivityTest:
insensitive_finder = self.finder(insensitive_path)
return self.find(sensitive_finder), self.find(insensitive_finder)
+ def env_changed(self, *, should_exist):
+ possibilities = b'PYTHONCASEOK', 'PYTHONCASEOK'
+ if any(x in self.importlib._bootstrap_external._os.environ
+ for x in possibilities) == should_exist:
+ self.skipTest('os.environ changes not reflected in '
+ '_os.environ')
+
def test_sensitive(self):
with test_support.EnvironmentVarGuard() as env:
env.unset('PYTHONCASEOK')
- if b'PYTHONCASEOK' in self.importlib._bootstrap_external._os.environ:
- self.skipTest('os.environ changes not reflected in '
- '_os.environ')
+ self.env_changed(should_exist=False)
sensitive, insensitive = self.sensitivity_test()
self.assertIsNotNone(sensitive)
self.assertIn(self.name, sensitive.get_filename(self.name))
@@ -52,9 +57,7 @@ class CaseSensitivityTest:
def test_insensitive(self):
with test_support.EnvironmentVarGuard() as env:
env.set('PYTHONCASEOK', '1')
- if b'PYTHONCASEOK' not in self.importlib._bootstrap_external._os.environ:
- self.skipTest('os.environ changes not reflected in '
- '_os.environ')
+ self.env_changed(should_exist=True)
sensitive, insensitive = self.sensitivity_test()
self.assertIsNotNone(sensitive)
self.assertIn(self.name, sensitive.get_filename(self.name))