diff options
author | Éric Araujo <merwok@netwok.org> | 2011-09-19 14:10:26 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-09-19 14:10:26 (GMT) |
commit | becf1c58572f29d4f35f448194e3ef9c535e3be0 (patch) | |
tree | 9fdee1cd0c48cbf29829bd2a3bfa94f2214ddec6 /Lib/test | |
parent | 2496f331a75c9dd30ef8588ae86179131227163a (diff) | |
parent | 28df8de6af5f859a212af75d818df68fce5a9377 (diff) | |
download | cpython-becf1c58572f29d4f35f448194e3ef9c535e3be0.zip cpython-becf1c58572f29d4f35f448194e3ef9c535e3be0.tar.gz cpython-becf1c58572f29d4f35f448194e3ef9c535e3be0.tar.bz2 |
Branch merge
Diffstat (limited to 'Lib/test')
-rwxr-xr-x | Lib/test/regrtest.py | 25 | ||||
-rw-r--r-- | Lib/test/test_sysconfig.py | 16 |
2 files changed, 31 insertions, 10 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 65438af..e46f935 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -965,7 +965,9 @@ class saved_test_environment: 'warnings.filters', 'asyncore.socket_map', 'logging._handlers', 'logging._handlerList', 'sys.gettrace', 'sys.warnoptions', 'threading._dangling', - 'multiprocessing.process._dangling') + 'multiprocessing.process._dangling', + 'sysconfig._CONFIG_VARS', 'sysconfig._SCHEMES', + ) def get_sys_argv(self): return id(sys.argv), sys.argv, sys.argv[:] @@ -1083,6 +1085,27 @@ class saved_test_environment: multiprocessing.process._dangling.clear() multiprocessing.process._dangling.update(saved) + def get_sysconfig__CONFIG_VARS(self): + # make sure the dict is initialized + sysconfig.get_config_var('prefix') + return (id(sysconfig._CONFIG_VARS), sysconfig._CONFIG_VARS, + dict(sysconfig._CONFIG_VARS)) + def restore_sysconfig__CONFIG_VARS(self, saved): + sysconfig._CONFIG_VARS = saved[1] + sysconfig._CONFIG_VARS.clear() + sysconfig._CONFIG_VARS.update(saved[2]) + + def get_sysconfig__SCHEMES(self): + # it's mildly evil to look at the internal attribute, but it's easier + # than copying a RawConfigParser object + return (id(sysconfig._SCHEMES), sysconfig._SCHEMES._sections, + sysconfig._SCHEMES._sections.copy()) + def restore_sysconfig__SCHEMES(self, saved): + sysconfig._SCHEMES._sections = saved[1] + sysconfig._SCHEMES._sections.clear() + sysconfig._SCHEMES._sections.update(saved[2]) + + def resource_info(self): for name in self.resources: method_suffix = name.replace('.', '_') diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index 773d523..08b40a1 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -39,7 +39,7 @@ class TestSysConfig(unittest.TestCase): self._config_vars = copy(sysconfig._CONFIG_VARS) self._added_envvars = [] self._changed_envvars = [] - for var in ('MACOSX_DEPLOYMENT_TARGET', 'Path'): + for var in ('MACOSX_DEPLOYMENT_TARGET', 'PATH'): if var in os.environ: self._changed_envvars.append((var, os.environ[var])) else: @@ -87,21 +87,19 @@ class TestSysConfig(unittest.TestCase): scheme = get_paths() default_scheme = _get_default_scheme() wanted = _expand_vars(default_scheme, None) - wanted = list(wanted.items()) - wanted.sort() - scheme = list(scheme.items()) - scheme.sort() + wanted = sorted(wanted.items()) + scheme = sorted(scheme.items()) self.assertEqual(scheme, wanted) def test_get_path(self): - # xxx make real tests here + # XXX make real tests here for scheme in _SCHEMES: for name in _SCHEMES[scheme]: res = get_path(name, scheme) def test_get_config_vars(self): cvars = get_config_vars() - self.assertTrue(isinstance(cvars, dict)) + self.assertIsInstance(cvars, dict) self.assertTrue(cvars) def test_get_platform(self): @@ -236,8 +234,8 @@ class TestSysConfig(unittest.TestCase): # On Windows, the EXE needs to know where pythonXY.dll is at so we have # to add the directory to the path. if sys.platform == "win32": - os.environ["Path"] = "{};{}".format( - os.path.dirname(sys.executable), os.environ["Path"]) + os.environ["PATH"] = "{};{}".format( + os.path.dirname(sys.executable), os.environ["PATH"]) # Issue 7880 def get(python): |