Skip to content

Commit

Permalink
Add failing test to check whether all top-level dependencies in a req…
Browse files Browse the repository at this point in the history
…uirements file are upgraded. Currently only the first will be upgraded.
  • Loading branch information
ejucovy committed Jul 2, 2012
1 parent 09c096b commit e192a41
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test_upgrade.py
Expand Up @@ -91,6 +91,30 @@ def test_upgrade_with_unneeded_recursive_upgrades_explicitly_requested():
assert env.site_packages/ 'initools'/'__init__.py' in result.files_updated, 'pip install --upgrade failed to upgrade recursive dependency INITools when it was asked to'


def test_upgrade_reqs_file_without_unneeded_recursive_upgrades():
"""
When running non-recursive --upgrade against a requirements file, every package
explicitly listed in the requirements file should be upgraded; but any recursive
dependencies should not be upgraded.
"""
env = reset_env()
run_pip('install', 'INITools==0.2')
run_pip('install', 'PyLogo==0.1')

to_install = abspath(join(here, 'packages', 'FSPkgUsesInitools'))
result = run_pip('install', to_install)

write_file('test-req.txt', textwrap.dedent("""\
%(FSPkgUsesInitools)s
PyLogo
""" % {'FSPkgUsesInitools': to_install}))

result = run_pip('install', '--upgrade', '-r', env.scratch_path/ 'test-req.txt')

assert env.site_packages/ 'initools'/'__init__.py' not in result.files_updated, 'pip install --upgrade upgraded recursive dependency INITools when it should not have'
assert env.site_packages/ 'pylogo'/'__init__.py' in result.files_updated, 'pip install --upgrade failed to upgrade explicit dependency PyLogo when it should have'


def test_upgrade_force_reinstall_newest():
"""
Force reinstallation of a package even if it is already at its newest
Expand Down Expand Up @@ -247,3 +271,4 @@ 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

0 comments on commit e192a41

Please sign in to comment.