Repository navigation
Make pulptest work from an installed package - #953
Merged
Merged
Conversation
get_test_suite() discovered tests in the relative path "pulp/tests", so the pulptest entry point only worked when run from the repository root. Discover relative to the tests package instead, and include the gitignored MPS fixtures in the sdist and wheel so test_write_mps can find them. Fixes #951
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #951.
get_test_suite()passes the relative path"pulp/tests"(withtop_level_dir=".") tounittestdiscovery, so thepulptestentry point only works when it's run from the repository root. From anywhere else it fails withImportError: Start directory is not importable: 'pulp/tests'.Changes:
run_tests.py: discover relative to the tests package itself, using the directory that containspulpas the top level. Runningpulp/tests/run_tests.pyfrom the checkout (as CI does) behaves the same.pyproject.toml: as @mgorny noted in the issue, the next failure istest_write_mps, becausepulp/tests/fixtures/mps/*.mpsis missing from both the 4.0.0 wheel and the sdist.*.mpsis in.gitignoreand maturin leaves out ignored files, so I added an explicit[tool.maturin] includefor the fixtures.test_run_tests.py: a small regression test that callsget_test_suite()from a temporary working directory. It fails without the change and passes with it.Tested on Windows, Python 3.12:
pulptestfails with the error from the issueuv build), run fromC:\: the wheel and sdist now contain the 10 fixture files, andpulptestgivesRan 1031 tests ... OK (skipped=906)uv run --all-extras --no-extra mosek pulp/tests/run_tests.pygivesOKA wheel built from the sdist still hits #949 (the
pulp/rust/targetrecursion). That's unrelated to this change and is handled in #950.