summaryrefslogtreecommitdiffstats
path: root/Lib/packaging/tests
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-05-19 23:56:42 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-05-19 23:56:42 (GMT)
commit4050c69f78a9cfb9b16fe7a1bfae8e9fbda89024 (patch)
tree39863b41fe614f066d1d3e1c2de847422fc56e41 /Lib/packaging/tests
parente1e3b1297962c85c70e7ed76fb997f054f2d51ef (diff)
downloadcpython-4050c69f78a9cfb9b16fe7a1bfae8e9fbda89024.zip
cpython-4050c69f78a9cfb9b16fe7a1bfae8e9fbda89024.tar.gz
cpython-4050c69f78a9cfb9b16fe7a1bfae8e9fbda89024.tar.bz2
packaging.tests.test_command_install_data: restore correctly sysconfig._SCHEMES
Diffstat (limited to 'Lib/packaging/tests')
-rw-r--r--Lib/packaging/tests/test_command_install_data.py15
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
index 8b8bbac..0486427 100644
--- a/Lib/packaging/tests/test_command_install_data.py
+++ b/Lib/packaging/tests/test_command_install_data.py
@@ -11,15 +11,22 @@ class InstallDataTestCase(support.TempdirManager,
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 @@ class InstallDataTestCase(support.TempdirManager,
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',