summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/tests/test_install.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/distutils/tests/test_install.py')
-rw-r--r--Lib/distutils/tests/test_install.py53
1 files changed, 19 insertions, 34 deletions
diff --git a/Lib/distutils/tests/test_install.py b/Lib/distutils/tests/test_install.py
index 59e9080..76fa02a 100644
--- a/Lib/distutils/tests/test_install.py
+++ b/Lib/distutils/tests/test_install.py
@@ -5,14 +5,12 @@ import os.path
import sys
import unittest
import site
-import sysconfig
-from sysconfig import (get_scheme_names, _CONFIG_VARS, _INSTALL_SCHEMES,
- get_config_var, get_path)
from test.support import captured_stdout
from distutils.command.install import install
from distutils.command import install as install_module
+from distutils.command.install import INSTALL_SCHEMES
from distutils.core import Distribution
from distutils.errors import DistutilsOptionError
@@ -38,23 +36,9 @@ class InstallTestCase(support.TempdirManager,
build_lib=os.path.join(builddir, "lib"),
)
-
-
- posix_prefix = _INSTALL_SCHEMES['posix_prefix']
- old_posix_prefix = posix_prefix['platinclude']
- posix_prefix['platinclude'] = \
- '{platbase}/include/python{py_version_short}'
-
- posix_home = _INSTALL_SCHEMES['posix_home']
- old_posix_home = posix_home['platinclude']
- posix_home['platinclude'] = '{base}/include/python'
- try:
- cmd = install(dist)
- cmd.home = destination
- cmd.ensure_finalized()
- finally:
- posix_home['platinclude'] = old_posix_home
- posix_prefix['platinclude'] = old_posix_prefix
+ cmd = install(dist)
+ cmd.home = destination
+ cmd.ensure_finalized()
self.assertEqual(cmd.install_base, destination)
self.assertEqual(cmd.install_platbase, destination)
@@ -79,19 +63,18 @@ class InstallTestCase(support.TempdirManager,
return
# preparing the environement for the test
- self.old_user_base = get_config_var('userbase')
- self.old_user_site = get_path('purelib', '%s_user' % os.name)
+ self.old_user_base = site.USER_BASE
+ self.old_user_site = site.USER_SITE
self.tmpdir = self.mkdtemp()
self.user_base = os.path.join(self.tmpdir, 'B')
self.user_site = os.path.join(self.tmpdir, 'S')
- _CONFIG_VARS['userbase'] = self.user_base
- scheme = _INSTALL_SCHEMES['%s_user' % os.name]
- scheme['purelib'] = self.user_site
+ site.USER_BASE = self.user_base
+ site.USER_SITE = self.user_site
+ install_module.USER_BASE = self.user_base
+ install_module.USER_SITE = self.user_site
def _expanduser(path):
- if path[0] == '~':
- path = os.path.normpath(self.tmpdir) + path[1:]
- return path
+ return self.tmpdir
self.old_expand = os.path.expanduser
os.path.expanduser = _expanduser
@@ -99,17 +82,19 @@ class InstallTestCase(support.TempdirManager,
# this is the actual test
self._test_user_site()
finally:
- _CONFIG_VARS['userbase'] = self.old_user_base
- scheme['purelib'] = self.old_user_site
+ site.USER_BASE = self.old_user_base
+ site.USER_SITE = self.old_user_site
+ install_module.USER_BASE = self.old_user_base
+ install_module.USER_SITE = self.old_user_site
os.path.expanduser = self.old_expand
def _test_user_site(self):
- schemes = get_scheme_names()
- for key in ('nt_user', 'posix_user', 'os2_home'):
- self.assertTrue(key in schemes)
+ for key in ('nt_user', 'unix_user', 'os2_home'):
+ self.assertTrue(key in INSTALL_SCHEMES)
dist = Distribution({'name': 'xx'})
cmd = install(dist)
+
# making sure the user option is there
options = [name for name, short, lable in
cmd.user_options]
@@ -200,7 +185,7 @@ class InstallTestCase(support.TempdirManager,
with open(cmd.record) as f:
self.assertEquals(len(f.readlines()), 1)
- def _test_debug_mode(self):
+ def test_debug_mode(self):
# this covers the code called when DEBUG is set
old_logs_len = len(self.logs)
install_module.DEBUG = True