diff options
| author | Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de> | 2010-02-11 21:32:14 +0100 |
|---|---|---|
| committer | Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de> | 2010-02-11 21:32:14 +0100 |
| commit | c14e1a1398cf7ece7a4bcb15317868163789d879 (patch) | |
| tree | 334b85698e44fda21d656a02d57f419e30c4c43f /setuptools/tests/test_easy_install.py | |
| parent | 2de12a23118f5eff414f232e0fdb50dd74362fa9 (diff) | |
| download | external_python_setuptools-c14e1a1398cf7ece7a4bcb15317868163789d879.tar.gz external_python_setuptools-c14e1a1398cf7ece7a4bcb15317868163789d879.tar.bz2 external_python_setuptools-c14e1a1398cf7ece7a4bcb15317868163789d879.zip | |
enable easy_install --user, *warning breaks tests*
the test-isolation got borked and operates on the users home instead of the test-tempdirs
--HG--
branch : distribute
extra : rebase_source : 1e9bf310b6ba92629d7ba494af17f519cfe17dc5
Diffstat (limited to 'setuptools/tests/test_easy_install.py')
| -rw-r--r-- | setuptools/tests/test_easy_install.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index ff9fa31d..be1513cc 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -2,8 +2,10 @@ """ import sys import os, shutil, tempfile, unittest +import site from setuptools.command.easy_install import easy_install, get_script_args, main from setuptools.command.easy_install import PthDistributions +from setuptools.command import easy_install as easy_install_pkg from setuptools.dist import Distribution from pkg_resources import Distribution as PRDistribution @@ -108,3 +110,51 @@ class TestPTHFileWriter(unittest.TestCase): pth.add(PRDistribution('/test/location/does-not-have-to-exist')) self.assertFalse(pth.dirty) + + +class TestUserInstallTest(unittest.TestCase): + + def setUp(self): + self.dir = tempfile.mkdtemp() + setup = os.path.join(self.dir, 'setup.py') + f = open(setup, 'w') + f.write(SETUP_PY) + f.close() + self.old_cwd = os.getcwd() + os.chdir(self.dir) + if sys.version >= "2.6": + self.old_base = site.USER_BASE + site.USER_BASE = easy_install_pkg.USER_BASE = tempfile.mkdtemp() + self.old_site = site.USER_SITE + site.USER_SITE = easy_install_pkg.USER_SITE = tempfile.mkdtemp() + + def tearDown(self): + os.chdir(self.old_cwd) + shutil.rmtree(self.dir) + if sys.version >= "2.6": + shutil.rmtree(site.USER_BASE) + shutil.rmtree(site.USER_SITE) + easy_install_pkg.USER_BASE = site.USER_BASE = self.old_base + easy_install_pkg.USER_SITE = site.USER_SITE = self.old_site + + def test_install(self): + if sys.version < "2.6": + return + dist = Distribution() + dist.script_name = 'setup.py' + cmd = easy_install(dist) + cmd.user = 1 + 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']) + |
