Skip to content

Commit

Permalink
Add test cases to check different combinations of pins
Browse files Browse the repository at this point in the history
  • Loading branch information
IceTDrinker committed Feb 24, 2021
1 parent 04154d2 commit f77201c
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/test_cli_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1576,6 +1576,26 @@ def test_triple_equal_pinned_dependency_is_used(
)
make_wheel(test_package_2, dists_dir)

# Case 1 ===
with open("requirements.in", "w") as reqs_in:
reqs_in.write("test-package-1===1.7.1\n")

out = runner.invoke(cli, ["--find-links", str(dists_dir)])

assert out.exit_code == 0, out
assert "test-package-1===1.7.1" in out.stderr

# Case 2 ==
with open("requirements.in", "w") as reqs_in:
reqs_in.write("test-package-1==1.7.1\n")

out = runner.invoke(cli, ["--find-links", str(dists_dir)])

assert out.exit_code == 0, out
assert "test-package-1==1.7.1" in out.stderr

# Case 3 test_package_1 pinned by user with ===
# but pinned by package with ==, prefer ===
with open("requirements.in", "w") as reqs_in:
reqs_in.write("test-package-1===1.7.1\n")
reqs_in.write("test-package-2==0.8.2\n")
Expand All @@ -1585,3 +1605,26 @@ def test_triple_equal_pinned_dependency_is_used(
assert out.exit_code == 0, out
assert "test-package-1===1.7.1" in out.stderr
assert "test-package-2==0.8.2" in out.stderr

# Case 4 test_package_1 pinned by user with ===
# but pinned by package with ==, prefer ===
# Different pin for test_package_2
with open("requirements.in", "w") as reqs_in:
reqs_in.write("test-package-1===1.7.1\n")
reqs_in.write("test-package-2===0.8.2\n")

out = runner.invoke(cli, ["--find-links", str(dists_dir)])

assert out.exit_code == 0, out
assert "test-package-1===1.7.1" in out.stderr
assert "test-package-2===0.8.2" in out.stderr

# Case 5 only package 2 pinned with ===
with open("requirements.in", "w") as reqs_in:
reqs_in.write("test-package-2===0.8.2\n")

out = runner.invoke(cli, ["--find-links", str(dists_dir)])

assert out.exit_code == 0, out
assert "test-package-1==1.7.1" in out.stderr
assert "test-package-2===0.8.2" in out.stderr

0 comments on commit f77201c

Please sign in to comment.