-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7876 from pfmoore/new_resolver_tests
Add some functional tests for the new resolver
- Loading branch information
Showing
1 changed file
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import json | ||
|
||
from tests.lib import create_basic_wheel_for_package | ||
|
||
|
||
def assert_installed(script, **kwargs): | ||
ret = script.pip('list', '--format=json') | ||
installed = set( | ||
(val['name'], val['version']) | ||
for val in json.loads(ret.stdout) | ||
) | ||
assert set(kwargs.items()) <= installed | ||
|
||
|
||
def test_new_resolver_can_install(script): | ||
create_basic_wheel_for_package( | ||
script, | ||
"simple", | ||
"0.1.0", | ||
) | ||
script.pip( | ||
"install", "--unstable-feature=resolver", | ||
"--no-cache-dir", "--no-index", | ||
"--find-links", script.scratch_path, | ||
"simple" | ||
) | ||
assert_installed(script, simple="0.1.0") | ||
|
||
|
||
def test_new_resolver_can_install_with_version(script): | ||
create_basic_wheel_for_package( | ||
script, | ||
"simple", | ||
"0.1.0", | ||
) | ||
script.pip( | ||
"install", "--unstable-feature=resolver", | ||
"--no-cache-dir", "--no-index", | ||
"--find-links", script.scratch_path, | ||
"simple==0.1.0" | ||
) | ||
assert_installed(script, simple="0.1.0") | ||
|
||
|
||
def test_new_resolver_picks_latest_version(script): | ||
create_basic_wheel_for_package( | ||
script, | ||
"simple", | ||
"0.1.0", | ||
) | ||
create_basic_wheel_for_package( | ||
script, | ||
"simple", | ||
"0.2.0", | ||
) | ||
script.pip( | ||
"install", "--unstable-feature=resolver", | ||
"--no-cache-dir", "--no-index", | ||
"--find-links", script.scratch_path, | ||
"simple" | ||
) | ||
assert_installed(script, simple="0.2.0") | ||
|
||
|
||
def test_new_resolver_installs_dependencies(script): | ||
create_basic_wheel_for_package( | ||
script, | ||
"base", | ||
"0.1.0", | ||
depends=["dep"], | ||
) | ||
create_basic_wheel_for_package( | ||
script, | ||
"dep", | ||
"0.1.0", | ||
) | ||
script.pip( | ||
"install", "--unstable-feature=resolver", | ||
"--no-cache-dir", "--no-index", | ||
"--find-links", script.scratch_path, | ||
"base" | ||
) | ||
assert_installed(script, base="0.1.0", dep="0.1.0") |