Open chrysle opened 5 months ago
Alternatively, it's even better to emulate such a situation with artificial package stubs so that it doesn't need to hit the network.
@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/pip-tools@6.2.0"
)
out = runner.invoke(cli, ["-n", "--rebuild", "--no-build-isolation"])
- assert out.exit_code == 0
assert (
"pip-tools[coverage,testing] @ git+https://github.com/jazzband/pip-tools@6.2.0"
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.
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..
@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 stderr
is incomplete or something. Can it be some output buffering specific to windows? Do we need PYTHONUNBUFFERED=1
in tests?
See https://github.com/jazzband/pip-tools/pull/1681#issuecomment-2212541289 for context.
Contributor checklist
Maintainer checklist
backwards incompatible
,feature
,enhancement
,deprecation
,bug
,dependency
,docs
orskip-changelog
as they determine changelog listing.