summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rwxr-xr-xLib/test/regrtest.py25
-rw-r--r--Lib/test/test_sysconfig.py16
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):