-
-
Notifications
You must be signed in to change notification settings - Fork 611
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 build deps compilation for setuptools < 70.1.0
#2106
base: main
Are you sure you want to change the base?
Conversation
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.
This is not a correct fix. It just shoves the problem under the carpet. We need to address the underlying problem, which is revealed not due to pip
but because setuptools
changed. Yet, the bug is in pip-tools: #2104 (comment). The correct change in the test is to include something like -P 'setuptools < 70.1.0'
. But that should be accompanied with a fix for the bug.
Alternatively, it's even better to emulate such a situation with artificial package stubs so that it doesn't need to hit the network. |
pip
24.0setuptools < 70.1.0
e89a2f4
to
66b6382
Compare
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
@webknjaz I reworked the PR; please have a look. Of course there are still the failing Windows tests, can we just drop that horrible Microsoft product ;-)? |
Slightly changing the order of assertions should help see more details into the errors: diff --git a/tests/test_cli_compile.py b/tests/test_cli_compile.py
index c5031fc..8db0038 100644
--- a/tests/test_cli_compile.py
+++ b/tests/test_cli_compile.py
@@ -787,13 +787,13 @@ def test_direct_reference_with_extras(runner):
"pip-tools[testing,coverage] @ git+https://github.com/jazzband/[email protected]"
)
out = runner.invoke(cli, ["-n", "--rebuild", "--no-build-isolation"])
- assert out.exit_code == 0
assert (
"pip-tools[coverage,testing] @ git+https://github.com/jazzband/[email protected]"
in out.stderr
)
assert "pytest==" in out.stderr
assert "pytest-cov==" in out.stderr
+ assert out.exit_code == 0
def test_input_file_without_extension(pip_conf, runner): Generally, I prefer to compare |
That won't be necessary if you'll follow the principle of a single assertion per test. Then pytest will print out everything. But personally, I have |
@chrysle the windows failure is because of the deprecation warning in pip, right? |
Could you elaborate on that? It seems that the resolver only found some pre-versions of a package, only I don't know much because the output is shortened. |
Yeah, it's weird. Somebody needs to use https://github.com/marketplace/actions/debugging-with-tmate to see what's happening on Windows. The vars in CI seem to suggest that |
try: | ||
assert out.exit_code == 0 | ||
assert expected == out.stdout | ||
except Exception: # pragma: no cover | ||
print(out.stdout) | ||
print(out.stderr) | ||
raise |
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.
Let's not include this hack with more complex logic. This should be better:
try: | |
assert out.exit_code == 0 | |
assert expected == out.stdout | |
except Exception: # pragma: no cover | |
print(out.stdout) | |
print(out.stderr) | |
raise | |
assert 0 == out.exit_code and expected == out.stdout, f"\n{out.stdout=}\n\n{out.stderr=}\n\n" |
"--constraint", | ||
os.fspath(tmp_path / "constraints.txt"), | ||
"--upgrade-package", | ||
"setuptools < 70.1.0", # setuptools>=70.1.0 doesn't require wheel any more |
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.
FWIW, it'd be better to make it not need internet access. But that's not a blocker, just something to think about for the future.
assert dependency in out.stderr | ||
assert out.exit_code == 0 |
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.
I'd prefer not to include unrelated changes right in this PR. But if you keep this, it's probably better to merge the instructions into a single assert
statement. This way, it'd be following the AAA principle to the letter: one test == one assertion.
assert dependency in out.stderr | |
assert out.exit_code == 0 | |
assert 0 == out.exit_code and dependency in out.stderr |
See #1681 (comment) for context.
Contributor checklist
Maintainer checklist
backwards incompatible
,feature
,enhancement
,deprecation
,bug
,dependency
,docs
orskip-changelog
as they determine changelog listing.