summaryrefslogtreecommitdiff
path: root/setuptools/tests/test_easy_install.py
diff options
context:
space:
mode:
authorRonny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>2010-05-07 00:16:16 +0200
committerRonny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>2010-05-07 00:16:16 +0200
commit4fd89d186d4e968b7f5e99570b1e424d4c87148a (patch)
treef82aace34e1f5475f2148cfdc840276b8a9eee11 /setuptools/tests/test_easy_install.py
parent152c6fa220df3ce8c3f211d490bfe547b155b0e2 (diff)
parentf17c61c16afd4fd00634424511127c1086b39ef0 (diff)
downloadpython-setuptools-git-4fd89d186d4e968b7f5e99570b1e424d4c87148a.tar.gz
merge & adapt --user implication tests
--HG-- branch : distribute extra : rebase_source : 3de11ca77e02b58fb91f2660edd2c9593bebf3cd
Diffstat (limited to 'setuptools/tests/test_easy_install.py')
-rw-r--r--setuptools/tests/test_easy_install.py36
1 files changed, 20 insertions, 16 deletions
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index e02798c6..7fd5bdd9 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -148,10 +148,13 @@ class TestUserInstallTest(unittest.TestCase):
self.old_cwd = os.getcwd()
os.chdir(self.dir)
if sys.version >= "2.6":
+ self.old_enable = site.ENABLE_USER_SITE
+ self.old_file = easy_install_pkg.__file__
self.old_base = site.USER_BASE
site.USER_BASE = tempfile.mkdtemp()
self.old_site = site.USER_SITE
site.USER_SITE = tempfile.mkdtemp()
+ easy_install_pkg.__file__ = site.USER_SITE
def tearDown(self):
os.chdir(self.old_cwd)
@@ -161,28 +164,29 @@ class TestUserInstallTest(unittest.TestCase):
shutil.rmtree(site.USER_SITE)
site.USER_BASE = self.old_base
site.USER_SITE = self.old_site
+ site.ENABLE_USER_SITE = self.old_enable
+ easy_install_pkg.__file__ = self.old_file
- def test_install(self):
+ def test_user_install_implied(self):
+ site.ENABLE_USER_SITE = True # disabled sometimes
#XXX: replace with something meaningfull
- return
if sys.version < "2.6":
- return
+ return #SKIP
dist = Distribution()
dist.script_name = 'setup.py'
cmd = easy_install(dist)
- cmd.user = 1
cmd.args = ['py']
cmd.ensure_finalized()
- cmd.user = 1
- old_stdout = sys.stdout
- sys.stdout = StringIO()
- try:
- cmd.run()
- finally:
- sys.stdout = old_stdout
-
- # let's see if we got our egg link at the right place
- content = os.listdir(site.USER_SITE)
- content.sort()
- self.assertEquals(content, ['UNKNOWN.egg-link', 'easy-install.pth'])
+ self.assertTrue(cmd.user, 'user should be implied')
+ def test_user_install_not_implied_without_usersite_enabled(self):
+ site.ENABLE_USER_SITE = False # disabled sometimes
+ #XXX: replace with something meaningfull
+ if sys.version < "2.6":
+ return #SKIP
+ dist = Distribution()
+ dist.script_name = 'setup.py'
+ cmd = easy_install(dist)
+ cmd.args = ['py']
+ cmd.initialize_options()
+ self.assertFalse(cmd.user, 'NOT user should be implied')