1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

setuptools upgrade tests

This commit is contained in:
Marcus Smith 2013-07-27 00:58:56 -07:00
parent b9aa34e883
commit 3e8924a7ec
9 changed files with 76 additions and 6 deletions

View file

@ -591,6 +591,7 @@ exec(compile(open(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
return
if self.is_wheel:
self.move_wheel_files(self.source_dir)
self.install_succeeded = True
return
temp_location = tempfile.mkdtemp('-record', 'pip-')

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,10 +1,12 @@
import os
import sys
import textwrap
from os.path import join
from nose.tools import nottest
from tests.lib import (reset_env, run_pip, assert_all_changes,
write_file, pyversion, _create_test_package,
_change_test_package_version, path_to_url, find_links)
from nose import SkipTest
from tests.lib import (reset_env, run_pip, assert_all_changes, src_folder,
write_file, pyversion, _create_test_package, pip_install_local,
_change_test_package_version, path_to_url, find_links)
from tests.lib.local_repos import local_checkout
@ -212,3 +214,67 @@ def test_upgrade_vcs_req_with_dist_found():
run_pip("install", req)
result = run_pip("install", "-U", req)
assert not "pypi.python.org" in result.stdout, result.stdout
class TestUpgradeSetuptools(object):
"""
Tests for upgrading to setuptools (using pip from src tree)
The tests use a *fixed* set of packages from our test packages dir
note: virtualenv-1.9.1 contains distribute-0.6.34
note: virtualenv-1.10 contains setuptools-0.9.7
"""
def prep_ve(self, version, distribute=False):
self.env = reset_env(pypi_cache=False)
pip_install_local('virtualenv==%s' %version)
args = ['virtualenv', self.env.scratch_path/'VE']
if distribute:
args.insert(1, '--distribute')
self.env.run(*args)
self.ve_bin = self.env.scratch_path/'VE'/'bin'
self.env.run(self.ve_bin/'pip', 'uninstall', '-y', 'pip')
self.env.run(self.ve_bin/'python', 'setup.py', 'install', cwd=src_folder, expect_stderr=True)
def test_py2_from_setuptools_6_to_setuptools_7(self):
if sys.version_info >= (3,):
raise SkipTest()
self.prep_ve('1.9.1')
result = self.env.run(self.ve_bin/'pip', 'install', '--no-index', '--find-links=%s' % find_links, '-U', 'setuptools')
assert "Found existing installation: setuptools 0.6c11" in result.stdout
result = self.env.run(self.ve_bin/'pip', 'list')
"setuptools (0.9.8)" in result.stdout
def test_py2_py3_from_distribute_6_to_setuptools_7(self):
self.prep_ve('1.9.1', distribute=True)
result = self.env.run(self.ve_bin/'pip', 'install', '--no-index', '--find-links=%s' % find_links, '-U', 'setuptools')
assert "Found existing installation: distribute 0.6.34" in result.stdout
result = self.env.run(self.ve_bin/'pip', 'list')
"setuptools (0.9.8)" in result.stdout
"distribute (0.7.3)" in result.stdout
def test_from_setuptools_7_to_setuptools_7(self):
self.prep_ve('1.10')
result = self.env.run(self.ve_bin/'pip', 'install', '--no-index', '--find-links=%s' % find_links, '-U', 'setuptools')
assert "Found existing installation: setuptools 0.9.7" in result.stdout
result = self.env.run(self.ve_bin/'pip', 'list')
"setuptools (0.9.8)" in result.stdout
def test_from_setuptools_7_to_setuptools_7_using_wheel(self):
self.prep_ve('1.10')
result = self.env.run(self.ve_bin/'pip', 'install', '--use-wheel', '--no-index', '--find-links=%s' % find_links, '-U', 'setuptools')
assert "Found existing installation: setuptools 0.9.7" in result.stdout
result = self.env.run(self.ve_bin/'pip', 'list')
"setuptools (0.9.8)" in result.stdout
def test_from_setuptools_7_to_setuptools_7_with_distribute_7_installed(self):
self.prep_ve('1.9.1', distribute=True)
result = self.env.run(self.ve_bin/'pip', 'install', '--no-index', '--find-links=%s' % find_links, '-U', 'setuptools')
result = self.env.run(self.ve_bin/'pip', 'install', '--no-index', '--find-links=%s' % find_links, 'setuptools==0.9.6')
result = self.env.run(self.ve_bin/'pip', 'list')
"setuptools (0.9.6)" in result.stdout
"distribute (0.7.3)" in result.stdout
result = self.env.run(self.ve_bin/'pip', 'install', '--no-index', '--find-links=%s' % find_links, '-U', 'setuptools')
assert "Found existing installation: setuptools 0.9.6" in result.stdout
result = self.env.run(self.ve_bin/'pip', 'list')
"setuptools (0.9.8)" in result.stdout
"distribute (0.7.3)" in result.stdout

View file

@ -93,19 +93,21 @@ env = None
def reset_env(environ=None,
system_site_packages=False,
sitecustomize=None,
pypi_cache=True,
insecure=True):
"""Return a test environment.
Keyword arguments:
environ: an environ object to use.
system_site_packages: create a virtualenv that simulates --system-site-packages.
pypi_cache: use pip's internal pypi cache
sitecustomize: a string containing python code to add to sitecustomize.py.
insecure: how to set the --insecure option for py25 tests.
"""
global env
env = TestPipEnvironment(environ, sitecustomize=sitecustomize)
env = TestPipEnvironment(environ, sitecustomize=sitecustomize, pypi_cache=pypi_cache)
TestPipEnvironment.rebuild_venv = False
if system_site_packages:
@ -277,7 +279,7 @@ class TestPipEnvironment(TestFileEnvironment):
verbose = False
rebuild_venv = True
def __init__(self, environ=None, sitecustomize=None):
def __init__(self, environ=None, sitecustomize=None, pypi_cache=True):
import virtualenv
self.root_path = fast_test_env_root
@ -368,7 +370,8 @@ class TestPipEnvironment(TestFileEnvironment):
#create sitecustomize.py and add patches
self._create_empty_sitecustomize()
self._use_cached_pypi_server()
if pypi_cache:
self._use_cached_pypi_server()
if sitecustomize:
self._add_to_sitecustomize(sitecustomize)