diff options
-rw-r--r-- | .gitignore | 26 | ||||
-rw-r--r-- | .hgignore | 21 | ||||
-rw-r--r-- | setuptools/tests/test_integration.py | 48 |
3 files changed, 42 insertions, 53 deletions
@@ -1,18 +1,16 @@ -*.pyc -*~ -*.swp -.coverage -.tox -distribute.egg-info -setuptools.egg-info +# syntax: glob +bin build dist -lib -bin include -\.Python -*.swp +lib +distribute.egg-info +setuptools.egg-info +.coverage +.tox CHANGES (links).txt -.git* -py-*.egg -pytest-*.egg +*.egg +*.py[cod] +*.swp +*~ +.hg* @@ -1,17 +1,16 @@ syntax: glob -*.pyc -*~ -*.swp -.coverage -.tox -distribute.egg-info -setuptools.egg-info +bin build dist -lib -bin include -\.Python -*.swp +lib +distribute.egg-info +setuptools.egg-info +.coverage +.tox CHANGES (links).txt +*.egg +*.py[cod] +*.swp +*~ .git* diff --git a/setuptools/tests/test_integration.py b/setuptools/tests/test_integration.py index 3938ccc5..7144aa6c 100644 --- a/setuptools/tests/test_integration.py +++ b/setuptools/tests/test_integration.py @@ -5,10 +5,7 @@ Try to install a few packages. import glob import os -import shutil -import site import sys -import tempfile import pytest @@ -18,44 +15,35 @@ from setuptools.dist import Distribution @pytest.fixture -def install_context(request): +def install_context(request, tmpdir, monkeypatch): """Fixture to set up temporary installation directory. """ # Save old values so we can restore them. - new_cwd = tempfile.mkdtemp() - old_cwd = os.getcwd() - old_enable_site = site.ENABLE_USER_SITE - old_file = easy_install_pkg.__file__ - old_base = site.USER_BASE - old_site = site.USER_SITE - old_ppath = os.environ.get('PYTHONPATH') + new_cwd = tmpdir.mkdir('cwd') + user_base = tmpdir.mkdir('user_base') + user_site = tmpdir.mkdir('user_site') + install_dir = tmpdir.mkdir('install_dir') def fin(): - os.chdir(old_cwd) - shutil.rmtree(new_cwd) - shutil.rmtree(site.USER_BASE) - shutil.rmtree(site.USER_SITE) - site.USER_BASE = old_base - site.USER_SITE = old_site - site.ENABLE_USER_SITE = old_enable_site - easy_install_pkg.__file__ = old_file - os.environ['PYTHONPATH'] = old_ppath or '' + new_cwd.remove() + user_base.remove() + user_site.remove() + install_dir.remove() request.addfinalizer(fin) # Change the environment and site settings to control where the # files are installed and ensure we do not overwrite anything. - site.USER_BASE = tempfile.mkdtemp() - site.USER_SITE = tempfile.mkdtemp() - easy_install_pkg.__file__ = site.USER_SITE - os.chdir(new_cwd) - install_dir = tempfile.mkdtemp() - sys.path.append(install_dir) - os.environ['PYTHONPATH'] = os.path.pathsep.join(sys.path) + monkeypatch.chdir(new_cwd) + monkeypatch.setattr(easy_install_pkg, '__file__', user_site.strpath) + monkeypatch.setattr('site.USER_BASE', user_base.strpath) + monkeypatch.setattr('site.USER_SITE', user_site.strpath) + monkeypatch.setattr('sys.path', sys.path + [install_dir.strpath]) + monkeypatch.setenv('PYTHONPATH', os.path.pathsep.join(sys.path)) # Set up the command for performing the installation. dist = Distribution() cmd = easy_install(dist) - cmd.install_dir = install_dir + cmd.install_dir = install_dir.strpath return cmd @@ -68,20 +56,24 @@ def _install_one(requirement, cmd, pkgname, modulename): assert dest_path assert os.path.exists(os.path.join(dest_path[0], pkgname, modulename)) + def test_stevedore(install_context): _install_one('stevedore', install_context, 'stevedore', 'extension.py') + @pytest.mark.xfail def test_virtualenvwrapper(install_context): _install_one('virtualenvwrapper', install_context, 'virtualenvwrapper', 'hook_loader.py') + @pytest.mark.xfail def test_pbr(install_context): _install_one('pbr', install_context, 'pbr', 'core.py') + @pytest.mark.xfail def test_python_novaclient(install_context): _install_one('python-novaclient', install_context, |