]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #13890: Fix importlib case-sensitivity tests to not run on Windows.
authorBrett Cannon <brett@python.org>
Mon, 30 Jan 2012 17:48:16 +0000 (12:48 -0500)
committerBrett Cannon <brett@python.org>
Mon, 30 Jan 2012 17:48:16 +0000 (12:48 -0500)
Thanks to os.environ under Windows only updating the dict and not the
environment itself (as exposed by nt.environ), tests using
PYTHONCASEOK always fail. Now the tests are skipped when os.environ
does not do what is expected.

Lib/importlib/test/source/test_case_sensitivity.py

index 73777de4ba4a73c3e438cec360ba3e12c52d1e7e..569f516d5a2289f8e122d3beb5a63771a0c8cf34 100644 (file)
@@ -37,6 +37,9 @@ class CaseSensitivityTest(unittest.TestCase):
     def test_sensitive(self):
         with test_support.EnvironmentVarGuard() as env:
             env.unset('PYTHONCASEOK')
+            if b'PYTHONCASEOK' in _bootstrap._os.environ:
+                self.skipTest('os.environ changes not reflected in '
+                              '_os.environ')
             sensitive, insensitive = self.sensitivity_test()
             self.assertTrue(hasattr(sensitive, 'load_module'))
             self.assertIn(self.name, sensitive.get_filename(self.name))
@@ -45,6 +48,9 @@ class CaseSensitivityTest(unittest.TestCase):
     def test_insensitive(self):
         with test_support.EnvironmentVarGuard() as env:
             env.set('PYTHONCASEOK', '1')
+            if b'PYTHONCASEOK' not in _bootstrap._os.environ:
+                self.skipTest('os.environ changes not reflected in '
+                              '_os.environ')
             sensitive, insensitive = self.sensitivity_test()
             self.assertTrue(hasattr(sensitive, 'load_module'))
             self.assertIn(self.name, sensitive.get_filename(self.name))