Skip to content

Fix CI: pytest job fails on Python 3.11 (numpy 2.5.2 needs 3.12+) - #22

Merged
JuanPabloRoldan merged 2 commits into
mainfrom
fix/ci-python-version-mismatch
Aug 21, 2026
Merged

Fix CI: pytest job fails on Python 3.11 (numpy 2.5.2 needs 3.12+)#22
JuanPabloRoldan merged 2 commits into
mainfrom
fix/ci-python-version-mismatch

Conversation

@JuanPabloRoldan

Copy link
Copy Markdown
Owner

The 3.11/3.12 test matrix broke main right after PR #20 merged -- numpy==2.5.2 has no Python 3.11 wheel, so pip install failed before any test ran. I added that matrix without ever verifying the pinned deps actually install on 3.11. Narrowed CI to Python 3.12 only, matching what's actually been verified and what the README already claimed. Also fixed a README line that (incorrectly) said CI covered both versions.

The pytest job ran a 3.11/3.12 matrix, but requirements.txt pins exact
versions (numpy==2.5.2 in particular) that were only ever verified
against Python 3.12, the actual local dev environment. numpy 2.5.2 does
not publish a 3.11 wheel (it requires Python >=3.12), so the 3.11 leg
failed at pip install before a single test ran:

  ERROR: Could not find a version that satisfies the requirement
  numpy==2.5.2 ... Requires-Python >=3.12

This is the same class of mistake fixed earlier (pinned versions not
matching the target Python version) -- I added the 3.11 leg to the CI
matrix without ever actually verifying the pinned requirements install
under 3.11.

Rather than guess at a second set of pins for 3.11, narrowed the pytest
job to Python 3.12 only, matching what has actually been verified and
what the README already claims (Tested on Python 3.12). Also fixed a
README line from the previous PR that claimed CI covered both Python
versions.

Verified locally: pytest and ruff both pass on 3.12, matching what CI
will now run.
Deeper, pre-existing bug uncovered by the same CI run as the previous
commit -- this one is not new, it predates all of this sessions work.

Every test file imports its target module as from src.module_name
import X (this was already the pattern in the original three test
files, before any of my changes). That import requires the repo root
to be on sys.path, so that src is resolvable as a namespace package.
pytest.ini only set pythonpath = src, which puts src/ itself on
sys.path -- that is what lets modules inside src/ import each other by
bare name (e.g. taylor_maccoll_solver.py doing from
isentropic_relations_solver import ...), but it does nothing for the
repo root.

Locally this went unnoticed because I always ran tests via
python -m pytest, and -m module invocation adds the current working
directory to sys.path as a side effect of how Python resolves -m.
The bare pytest command -- which is what the README documents and
what CI actually runs -- does not get that side effect, and failed
immediately before collecting a single test. Reproduced locally via
.venv/Scripts/pytest.exe -v (bypassing python -m) to confirm.

Fixed by setting pythonpath = . src in pytest.ini, adding the repo
root alongside src/ so both import styles resolve regardless of how
pytest is invoked.

Verified: .venv/Scripts/pytest.exe -v (bare entry point, matching CI
exactly) now collects and passes all 24 tests. ruff check . still
passes clean.
@JuanPabloRoldan
JuanPabloRoldan merged commit 56c68ae into main Aug 21, 2026
2 checks passed
@JuanPabloRoldan
JuanPabloRoldan deleted the fix/ci-python-version-mismatch branch August 21, 2026 18:41
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.

1 participant