Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

chrysle
Copy link
Contributor

@chrysle chrysle commented Jun 25, 2024

See #1681 (comment) for context.

Contributor checklist
  • Included tests for the changes.
  • PR title is short, clear, and ready to be included in the user-facing changelog.
Maintainer checklist
  • Verified one of these labels is present: backwards incompatible, feature, enhancement, deprecation, bug, dependency, docs or skip-changelog as they determine changelog listing.
  • Assign the PR to an existing or new milestone for the target version (following Semantic Versioning).

@chrysle chrysle added tests Testing and related things pip Related to pip skip-changelog Avoid listing in changelog labels Jun 25, 2024
Copy link
Member

@webknjaz webknjaz left a 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.

@webknjaz
Copy link
Member

webknjaz commented Jul 7, 2024

Alternatively, it's even better to emulate such a situation with artificial package stubs so that it doesn't need to hit the network.

@chrysle chrysle marked this pull request as draft July 17, 2024 14:43
@chrysle chrysle changed the title Fix CI for pip 24.0 Fix build deps compilation for setuptools < 70.1.0 Jul 22, 2024
@chrysle chrysle force-pushed the fix-ci branch 3 times, most recently from e89a2f4 to 66b6382 Compare July 22, 2024 08:12
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
@chrysle chrysle added bug Something is not working setuptools Related to compiling requirements with `setuptools` build backend and removed tests Testing and related things pip Related to pip skip-changelog Avoid listing in changelog labels Jul 22, 2024
@chrysle chrysle marked this pull request as ready for review July 22, 2024 08:28
@chrysle
Copy link
Contributor Author

chrysle commented Jul 22, 2024

@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 ;-)?

@chrysle chrysle requested a review from webknjaz July 23, 2024 19:26
@chrysle chrysle added this to the 7.4.2 milestone Jul 28, 2024
@WhyNotHugo
Copy link
Member

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 out.stderr before checking the status code in tests; if stderr isn't the expected output, pytest will print it when failing the assertion.

@webknjaz
Copy link
Member

Generally, I prefer to compare out.stderr before checking the status code in tests; if stderr isn't the expected output, pytest will print it when failing the assertion.

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 --showlocals in all configs so that the context is always printed..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working setuptools Related to compiling requirements with `setuptools` build backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants