diff options
author | Meador Inge <meadori@gmail.com> | 2013-09-04 00:54:40 (GMT) |
---|---|---|
committer | Meador Inge <meadori@gmail.com> | 2013-09-04 00:54:40 (GMT) |
commit | 3c561456380ff54efb3784a92ba74ee904470b35 (patch) | |
tree | cebcd54e56cedeba54a399e9abdc48eab401e4d5 /Lib/test/test_importlib/extension | |
parent | 2b0a98f5405866076456ed55ed6a382c7a3f4260 (diff) | |
parent | c9e1dcdd5323b11d1d4e901dbc74287a2672bc04 (diff) | |
download | cpython-3c561456380ff54efb3784a92ba74ee904470b35.zip cpython-3c561456380ff54efb3784a92ba74ee904470b35.tar.gz cpython-3c561456380ff54efb3784a92ba74ee904470b35.tar.bz2 |
Issue #16826: Revert fix while Windows issues are being worked out.
Diffstat (limited to 'Lib/test/test_importlib/extension')
-rw-r--r-- | Lib/test/test_importlib/extension/test_case_sensitivity.py | 37 |
1 files changed, 8 insertions, 29 deletions
diff --git a/Lib/test/test_importlib/extension/test_case_sensitivity.py b/Lib/test/test_importlib/extension/test_case_sensitivity.py index 5764756..2b536e2 100644 --- a/Lib/test/test_importlib/extension/test_case_sensitivity.py +++ b/Lib/test/test_importlib/extension/test_case_sensitivity.py @@ -6,8 +6,7 @@ from importlib import _bootstrap from importlib import machinery from .. import util from . import util as ext_util -import os -import subprocess + @util.case_insensitive_tests class ExtensionModuleCaseSensitivityTest(unittest.TestCase): @@ -31,34 +30,14 @@ class ExtensionModuleCaseSensitivityTest(unittest.TestCase): self.assertIsNone(loader) def test_case_insensitivity(self): - find_snippet = """if True: - from importlib import _bootstrap - import sys - finder = _bootstrap.FileFinder('{path}', - (_bootstrap.ExtensionFileLoader, - _bootstrap.EXTENSION_SUFFIXES)) - loader = finder.find_module('{bad_name}') - print(str(hasattr(loader, 'load_module'))) - """.format(bad_name=ext_util.NAME.upper(), path=ext_util.PATH) - - newenv = os.environ.copy() - newenv["PYTHONCASEOK"] = "1" - - def check_output(expected, extra_arg=None): - args = [sys.executable] - if extra_arg: - args.append(extra_arg) - args.extend(["-c", find_snippet]) - p = subprocess.Popen(args, stdout=subprocess.PIPE, env=newenv) - actual = p.communicate()[0].decode().strip() - self.assertEqual(expected, actual) - self.assertEqual(p.wait(), 0) - - # Test with PYTHONCASEOK=1. - check_output("True") + with 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') + loader = self.find_module() + self.assertTrue(hasattr(loader, 'load_module')) - # Test with PYTHONCASEOK=1 ignored because of -E. - check_output("False", "-E") |