Skip to content

test: add a packaging test so make test cannot pass on an empty suite - #94

Open
tschm wants to merge 1 commit into
alihaskar:masterfrom
tschm:rhiza_v1.3.3_testfloor
Open

test: add a packaging test so make test cannot pass on an empty suite#94
tschm wants to merge 1 commit into
alihaskar:masterfrom
tschm:rhiza_v1.3.3_testfloor

Conversation

@tschm

@tschm tschm commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Adds the one test a project needs to have before make test means anything, plus the pytest.ini that goes with it. Both come from rhiza v1.3.3; they are the part of that sync that depends on nothing else in it, so they land on master directly.

The hole this closes

make test searches TESTS_FOLDER for test_*.py / *_test.py and, finding none, prints a warning and exits 0. A project with no tests therefore passes make test, and so passes make all, while measuring nothing.

tests/test_rhiza_packaging.py fills that vacuum with a real invariant: the version declared in pyproject.toml is the version actually installed in the environment. That is the thing that breaks most often on a fresh checkout — a stale editable install after a rename, a uv sync that never ran, a package directory the build backend is not configured to pick up. Each of those otherwise surfaces as a confusing ImportError several files later.

It is deliberately self-contained: no fixtures, no conftest, no dependency on anything under .rhiza/tests.

pytest.ini

  • log_cli true → false. Live DEBUG logging on every run buries the result. Opt back in per-run: pytest -o log_cli=true --log-cli-level=DEBUG.
  • pythonpath = .rhiza/tests — resolved relative to rootdir, harmless when that directory is absent, so the synced suite is importable without each conftest editing sys.path at import time.
  • The class-scoped-instance-method fixture deprecation becomes an error, so it cannot regress silently. Matched by message rather than category on purpose: the category name is version-specific (PytestRemovedIn9Warning vs ...In10Warning) and naming a missing class breaks --resolution lowest-direct runs at parse time. Third-party DeprecationWarnings stay non-fatal.

Verification

Run on this branch against the current source: 173 passed.

Independent of my other open PRs (#91, #92, #93) — merge in any order.

`make test` searches TESTS_FOLDER for test_*.py / *_test.py and, finding
none, prints a warning and exits 0 — so a project with no tests passes
`make test` and therefore `make all` while measuring nothing. This adds the
one test that closes that hole: it asserts the version declared in
pyproject.toml is the version actually installed, which is the invariant that
breaks most often on a fresh checkout (a stale editable install, a `uv sync`
that never ran, a package directory the build backend does not pick up). Each
of those otherwise surfaces as a confusing ImportError several files later.

It is deliberately self-contained — no fixtures, no conftest — so it does not
depend on anything under .rhiza/tests.

pytest.ini alongside it:

- log_cli goes from true to false. Live DEBUG logging on every run buries the
  result; opt back in per-run with
  `pytest -o log_cli=true --log-cli-level=DEBUG`.
- pythonpath = .rhiza/tests, resolved relative to rootdir and harmless when
  that directory is absent, so the synced suite is importable without each
  conftest editing sys.path at import time.
- the class-scoped-instance-method fixture deprecation becomes an error, so it
  cannot regress silently. Matched by message rather than category, because
  the category name is version-specific (PytestRemovedIn9Warning vs ...In10)
  and naming a missing class breaks `--resolution lowest-direct` at parse
  time. Third-party DeprecationWarnings stay non-fatal.

Both files come from rhiza v1.3.3; they are the part of that sync that needs
nothing else from it. Verified on this branch: 173 passed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 18, 2026 03:27
tschm added a commit to tschm/pycharting that referenced this pull request Aug 18, 2026
The tail of the v0.18.8 -> v1.3.3 sync: the rhiza_*.yml callers repinned from
@v0.19.9 to @v1.3.3, three new workflows (fuzzing, mutation, scorecard), the
pre-commit and bandit configs, the ruff rule set, TESTS.md and the lock.

Everything separable has been separated and sent upstream: repo metadata
(alihaskar#91), the .rhiza/tests layout (alihaskar#92), the make layer and the
.rhiza/requirements removal (alihaskar#93), the packaging test and pytest.ini (alihaskar#94),
and the inert config and data files (alihaskar#95). What is left needs the v1.3.3 make
layer underneath it, or in ruff.toml's case needs source changes first.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a minimal “packaging invariant” test and updates pytest configuration so make test cannot succeed with an empty test suite, improving baseline CI signal for fresh checkouts.

Changes:

  • Add tests/test_rhiza_packaging.py to assert the installed distribution version matches pyproject.toml.
  • Update pytest.ini to adjust logging defaults, add .rhiza/tests to pythonpath, and make a specific pytest deprecation warning fatal.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/test_rhiza_packaging.py Introduces a baseline packaging/version invariant test to ensure the suite is non-empty and validates installs.
pytest.ini Tweaks pytest defaults (logging, import path, warning filtering) to support the synced template test layout and stricter deprecation handling.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +87 to +90
try:
found = installed_version(name)
except PackageNotFoundError:
pytest.skip(f"{name!r} is not installed as a distribution (a virtual project has no metadata)")
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.

2 participants