install wheel from local packages in tests

This commit is contained in:
Marcus Smith 2013-05-24 19:03:21 -07:00
parent 558c200f37
commit 32ce7b878e
7 changed files with 14 additions and 11 deletions

Binary file not shown.

Binary file not shown.

View File

@ -12,7 +12,7 @@ from mock import patch
from pip.util import rmtree, find_command
from pip.exceptions import BadCommand
from tests.test_pip import (here, reset_env, run_pip, pyversion, mkdir,
from tests.test_pip import (here, reset_env, run_pip, pyversion, mkdir, pip_install_local,
src_folder, write_file, path_to_url, find_links)
from tests.local_repos import local_checkout
from tests.path import Path
@ -551,7 +551,7 @@ def test_install_wheel_with_target():
Test installing a wheel using pip install --target
"""
env = reset_env(use_distribute=True)
run_pip('install', 'wheel')
pip_install_local('wheel')
target_dir = env.scratch_path/'target'
result = run_pip('install', 'simple.dist==0.1', '-t', target_dir, '--use-wheel',
'--no-index', '--find-links='+find_links)

View File

@ -1,7 +1,7 @@
import os
import textwrap
from os.path import abspath, exists, join
from tests.test_pip import (here, reset_env, run_pip,
from tests.test_pip import (here, reset_env, run_pip, pip_install_local,
write_file, mkdir, path_to_url, find_links)
from tests.local_repos import local_checkout
from tests.path import Path
@ -34,7 +34,7 @@ def test_no_clean_option_blocks_cleaning_after_wheel():
Test --no-clean option blocks cleaning after wheel build
"""
env = reset_env(use_distribute=True)
run_pip('install', 'wheel')
pip_install_local('wheel')
result = run_pip('wheel', '--no-clean', '--no-index', '--find-links=%s' % find_links, 'simple')
build = env.venv_path/'build'/'simple'
assert exists(build), "build/simple should still exist %s" % str(result)

View File

@ -489,6 +489,9 @@ def run_pip(*args, **kw):
del result.files_updated[path]
return result
def pip_install_local(*args, **kw):
"""Run 'pip install' using --find-links against our local test packages"""
run_pip('install', '--no-index', '--find-links=%s' % find_links, *args, **kw)
def write_file(filename, text, dest=None):
"""Write a file in the dest (default=env.scratch_path)

View File

@ -8,7 +8,7 @@ from os.path import abspath, join, curdir, isdir, isfile
from nose import SkipTest
from tests.local_repos import local_checkout
from tests.test_pip import (here, reset_env, run_pip, pyversion, assert_all_changes,
path_to_url, find_links)
path_to_url, find_links, pip_install_local)
patch_dist_in_site_packages = """
@ -246,7 +246,7 @@ class Tests_UserSite:
Test user install from wheel
"""
env = reset_env(system_site_packages=True, use_distribute=True)
run_pip('install', 'wheel')
pip_install_local('wheel')
result = run_pip('install', 'simple.dist==0.1', '--user', '--use-wheel',
'--no-index', '--find-links='+find_links)
egg_info_folder = env.user_site / 'simple.dist-0.1.dist-info'

View File

@ -12,7 +12,7 @@ from pip.index import PackageFinder
from pip import wheel
from pip.download import path_to_url as path_to_url_d
from tests.test_pip import (here, reset_env, run_pip, pyversion_nodot, write_file,
path_to_url, assert_raises_regexp, find_links)
path_to_url, assert_raises_regexp, find_links, pip_install_local)
@ -61,7 +61,7 @@ class TestPipWheel:
# virtualenv installs distribute in py3
raise SkipTest()
env = reset_env(use_distribute=False)
run_pip('install', 'wheel')
pip_install_local('wheel')
result = run_pip('wheel', '--no-index', '-f', find_links, 'simple==3.0', expect_error=True)
assert "'pip wheel' requires %s" % wheel.distribute_requirement in result.stdout, result.stdout
@ -70,7 +70,7 @@ class TestPipWheel:
Test 'pip wheel' success.
"""
env = reset_env(use_distribute=True)
run_pip('install', 'wheel')
pip_install_local('wheel')
result = run_pip('wheel', '--no-index', '-f', find_links, 'simple==3.0')
wheel_file_name = 'simple-3.0-py%s-none-any.whl' % pyversion_nodot
wheel_file_path = env.scratch/'wheelhouse'/wheel_file_name
@ -83,7 +83,7 @@ class TestPipWheel:
Test 'pip wheel' failure.
"""
env = reset_env(use_distribute=True)
run_pip('install', 'wheel')
pip_install_local('wheel')
result = run_pip('wheel', '--no-index', '-f', find_links, 'wheelbroken==0.1')
wheel_file_name = 'wheelbroken-0.1-py%s-none-any.whl' % pyversion_nodot
wheel_file_path = env.scratch/'wheelhouse'/wheel_file_name
@ -97,7 +97,7 @@ class TestPipWheel:
Test 'pip wheel' ignores editables and *.whl files in requirements
"""
env = reset_env(use_distribute=True)
run_pip('install', 'wheel')
pip_install_local('wheel')
local_wheel = '%s/simple.dist-0.1-py2.py3-none-any.whl' % find_links
local_editable = os.path.abspath(os.path.join(here, 'packages', 'FSPkg'))