New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix compile cached vcs packages #1649
Changes from 4 commits
a27a8f7
9b31c06
28bebfd
57012f6
ccfc3df
5beeb5c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -511,6 +511,39 @@ def test_editable_package_vcs(runner): | |
assert "click" in out.stderr # dependency of pip-tools | ||
|
||
|
||
@pytest.mark.network | ||
def test_compile_cached_vcs_package(runner): | ||
""" | ||
Test that cached vcs package does not interfere pip-compile results. | ||
|
||
Regression test for issue GH-1647. | ||
""" | ||
vcs_package = ( | ||
"six @ git+https://github.com/benjaminp/six@" | ||
"65486e4383f9f411da95937451205d3c7b61b9e1" | ||
) | ||
|
||
# Install and cache VCS package | ||
# TODO: install package in isolated environment | ||
subprocess.run( | ||
[ | ||
sys.executable, | ||
"-m" "pip", | ||
"install", | ||
vcs_package, | ||
], | ||
check=True, | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On my machine, this doesn't cause a wheel for six to be cached in I had a similar issue when writing the MWE script in #1647. Pip would not cache the wheel unless I installed another version of the VCS package first. Doing that doesn't seem to fix the issue here though. On my machine, replacing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggested changes atugushev/pip-tools@fix-compile-cached-vcs-1647...gschaffner:pip-tools:fix-compile-cached-vcs-1647. bb2e91edbd3d0f1bdd86c41e84c88621f8d35690 is failing—I can't find a way to get Pip to cache 1: My guess is that this is because six does not use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test works on CI. As you can see it fails without the fix: AssertionError: assert 'six @ git+ht...05d3c7b61b9e1' == 'six @ file:/...-none-any.whl' - six @ file:///Users/albert/Library/Caches/pip/wheels/b4/42/6d/bab90ef8caaba6e66b7c1b7e35d83fbe1b67ae9a1101839ff2/six-1.16.0-py2.py3-none-any.whl + six @ git+https://github.com/benjaminp/six@65486e4383f9f411da95937451205d3c7b61b9e1 I think that should be enough. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gschaffner what would you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for the delay! Without the fix, the test mistakenly passes on my laptop when run as $ git checkout 53f36d88bbaaad3ece3e964b015015690c6792e9 # or 835b7e58c4fb929e114d88fce7e1f911aef2c4cd
$ rm -r ~/.cache/pip/wheels
$ tox -e py310-piplatest-coverage -- --no-cov tests/test_cli_compile.py::test_compile_cached_vcs_package # or tox -e py310-piplatest-coverage Can you replicate? It seems like the test is not putting six into the cache. (My initial guess was that the test was failing (as it should) on GHA because six was already in the wheels cache loaded by This doesn't seem to be the case however—see that there is no wheel for six loaded in https://github.com/jazzband/pip-tools/runs/7439890847?check_suite_focus=true#step:7:223.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, but isn't it all fine if you just replace six with any other package? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That was my first thought. However, while the test works on CI, it can mistakenly pass in a different setup. This makes me think that the test is flaky and must be reworked in a way as suggested here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, thanks, yeah I'm on board to get the fix out ahead of the test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tracking issue #1686. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AndydeCleyre okay, all set. |
||
|
||
with open("requirements.in", "w") as req_in: | ||
req_in.write(vcs_package) | ||
|
||
out = runner.invoke(cli, ["--no-header", "--no-emit-options", "--no-annotate"]) | ||
|
||
assert out.exit_code == 0, out | ||
assert vcs_package == out.stderr.strip() | ||
|
||
|
||
@legacy_resolver_only | ||
def test_locally_available_editable_package_is_not_archived_in_cache_dir( | ||
pip_conf, tmpdir, runner | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad your
copy_install_requirement
extensibility made this easy!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's very handy indeed!