Skip to content

Make pulptest work from an installed package - #953

Merged
pchtsp merged 1 commit into
coin-or:masterfrom
cristianchiriac:fix-pulptest-installed
Oct 12, 2026
Merged

pchtsp merged 1 commit into
coin-or:masterfrom
cristianchiriac:fix-pulptest-installed

Conversation

@cristianchiriac

Copy link
Copy Markdown
Contributor

Fixes #951.

get_test_suite() passes the relative path "pulp/tests" (with top_level_dir=".") to unittest discovery, so the pulptest entry point only works when it's run from the repository root. From anywhere else it fails with ImportError: Start directory is not importable: 'pulp/tests'.

Changes:

  • run_tests.py: discover relative to the tests package itself, using the directory that contains pulp as the top level. Running pulp/tests/run_tests.py from the checkout (as CI does) behaves the same.
  • pyproject.toml: as @mgorny noted in the issue, the next failure is test_write_mps, because pulp/tests/fixtures/mps/*.mps is missing from both the 4.0.0 wheel and the sdist. *.mps is in .gitignore and maturin leaves out ignored files, so I added an explicit [tool.maturin] include for the fixtures.
  • test_run_tests.py: a small regression test that calls get_test_suite() from a temporary working directory. It fails without the change and passes with it.

Tested on Windows, Python 3.12:

  • official 4.0.0 wheel: pulptest fails with the error from the issue
  • wheel built from this branch (uv build), run from C:\: the wheel and sdist now contain the 10 fixture files, and pulptest gives Ran 1031 tests ... OK (skipped=906)
  • from the checkout: uv run --all-extras --no-extra mosek pulp/tests/run_tests.py gives OK

A wheel built from the sdist still hits #949 (the pulp/rust/target recursion). That's unrelated to this change and is handled in #950.

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
@CLAassistant

CLAassistant commented Oct 6, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@pchtsp
pchtsp merged commit 1b218ea into coin-or:master Oct 12, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pulptest no longer works in 4.0.0: ImportError: Start directory is not importable: 'pulp/tests'

3 participants