[Python-checkins] cpython: packaging.tests.test_command_install_data: restore correctly sysconfig._SCHEMES
victor.stinner
python-checkins at python.org
Fri May 20 01:56:50 CEST 2011
http://hg.python.org/cpython/rev/6267a4645f5f
changeset: 70218:6267a4645f5f
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Fri May 20 01:56:42 2011 +0200
summary:
packaging.tests.test_command_install_data: restore correctly sysconfig._SCHEMES
files:
Lib/packaging/tests/test_command_install_data.py | 15 +++++++--
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/Lib/packaging/tests/test_command_install_data.py b/Lib/packaging/tests/test_command_install_data.py
--- a/Lib/packaging/tests/test_command_install_data.py
+++ b/Lib/packaging/tests/test_command_install_data.py
@@ -11,15 +11,22 @@
unittest.TestCase):
def test_simple_run(self):
- self.addCleanup(setattr, sysconfig, '_SCHEMES', sysconfig._SCHEMES)
+ scheme = _get_default_scheme()
+ old_items = sysconfig._SCHEMES.items(scheme)
+ def restore():
+ sysconfig._SCHEMES.remove_section(scheme)
+ sysconfig._SCHEMES.add_section(scheme)
+ for option, value in old_items:
+ sysconfig._SCHEMES.set(scheme, option, value)
+ self.addCleanup(restore)
pkg_dir, dist = self.create_dist()
cmd = install_data(dist)
cmd.install_dir = inst = os.path.join(pkg_dir, 'inst')
- sysconfig._SCHEMES.set(_get_default_scheme(), 'inst',
+ sysconfig._SCHEMES.set(scheme, 'inst',
os.path.join(pkg_dir, 'inst'))
- sysconfig._SCHEMES.set(_get_default_scheme(), 'inst2',
+ sysconfig._SCHEMES.set(scheme, 'inst2',
os.path.join(pkg_dir, 'inst2'))
one = os.path.join(pkg_dir, 'one')
@@ -59,7 +66,7 @@
three = os.path.join(cmd.install_dir, 'three')
self.write_file(three, 'xx')
- sysconfig._SCHEMES.set(_get_default_scheme(), 'inst3',
+ sysconfig._SCHEMES.set(scheme, 'inst3',
cmd.install_dir)
cmd.data_files = {one: '{inst}/one', two: '{inst2}/two',
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list