This commit is contained in:
Brett Cannon 2016-07-15 11:55:21 -07:00
commit b3e73b30ff
4 changed files with 2357 additions and 2349 deletions

View file

@ -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))