Repository navigation
fix(tests): load the fixtures through addopts, not a root conftest - #42
Conversation
A `conftest.py` at the repository ROOT makes pytest put the root on `sys.path`. The root carries a second copy of `hivemind_cli_terminal`, and that copy wins the import, so `build_tests` installs a wheel it never tests and cannot detect a packaging defect. The root conftest held two things. `pytest_plugins` cannot move down, because pytest refuses that key in a non-top-level conftest, so hivescope's fixtures now load through `-p hivescope.pytest_fixtures` in `addopts`. That is the same plugin, loaded the same way, with no file at the root. The `pytest_terminal_summary` hook needs no top-level conftest and moves into `tests/` unchanged. Measured on dev 0a712e3, with the wheel built by `uv build` and installed non-editable with the `e2e` extra, which is what both workflows pass. The instrument prepends `raise ImportError(...)` to the WORKING TREE copy of `hivemind_cli_terminal/__init__.py` and changes nothing else, so a green run proves the wheel was imported. Path `tests/`, which is what `build_tests` and `coverage` both pass: root conftest, clean 19 passed, 1 skipped, 1 xfailed, 1 xpassed root conftest, tree poisoned 1 error during collection addopts, clean 19 passed, 1 skipped, 1 xfailed, 1 xpassed addopts, tree poisoned 19 passed, 1 skipped, 1 xfailed, 1 xpassed The counts are identical, which is the control for the fixtures: this suite is end to end and every cell needs hivescope's hub, so a plugin that failed to load could not leave 19 passing. The hook has its own control in the same output: the suite holds a real xpass, and the "XPASS - flip these xfail markers" banner still prints after the move. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
The results of your automated verification are here! 📜I've aggregated the results of the automated checks for this PR below. 🏷️ Release PreviewEnsuring our release notes are clear and concise. ✍️ Current:
🚀 Release Channel Compatibility Predicted next version:
📋 Repo HealthGiving the repo a clean bill of health! 🛁 ✅ All required files present. Latest Version: ✅ 🔍 LintAnother day, another successful automated run. 🌅 ✅ ruff: no issues in 14 file(s) 📊 CoverageA forensic look at what's being executed. 🔎 ❌ 27.5% total coverage Per-file coverage (3 files)
Full report: download the ⚖️ License CheckI've checked the license history of this repo. 📜 ✅ No license violations found. Policy: Apache 2.0 (universal donor). StrongCopyleft / NetworkCopyleft / WeakCopyleft / Other / Error categories fail. MPL allowed. 🔨 Build TestsThe build pipeline has reached its destination. 📍 ✅ All versions pass
Standard Automated Signature v2.0 🏷️ |
The defect
A
conftest.pyat the repository ROOT makes pytest put the root onsys.path. The root holds a second copy ofhivemind_cli_terminaland thatcopy wins the import, so
build_testsinstalls a wheel it never tests: apackaging defect cannot fail it.
This is the half of the
tests/__init__.pyclass that deleting a marker filedoes not fix. T-6298 measured this repository defective with both columns
reading working tree.
The fix, and why it is not a plain move
The root conftest held two things.
pytest_pluginscannot move down: pytest refuses that key in a non-top-levelconftest. hivescope's fixtures now load through
-p hivescope.pytest_fixturesin
[tool.pytest.ini_options] addopts— the same plugin, loaded the same way,with no file at the root.
The
pytest_terminal_summaryhook needs no top-level conftest, so it movesinto
tests/unchanged.The measurement
Built on dev 0a712e3 with
uv build, installed non-editable with thee2eextra, which is what both workflows pass. The instrument prepends
raise ImportError(...)to the WORKING TREE copy ofhivemind_cli_terminal/__init__.pyand changes nothing else, so a green runproves the wheel was imported. Path
tests/, whichbuild_testsandcoverageboth pass.The control for each workflow that loads fixtures
Two workflows run pytest here,
build_testsandcoverage, and both pass thee2eextra and thetests/path, so one cell covers the shape both use.The identical counts ARE the fixture control in this repository: the suite is
end to end and every cell needs hivescope's hub, so a plugin that failed to
load could not leave 19 cells passing. It would error at setup instead.
The hook has its own control in the same output. This suite holds a real
xpass,
tests/e2e/test_bridge1_conformance.py::test_fifo_order_relay_chain,and the banner still prints after the move:
Surface
pyproject.tomlgains a[tool.pytest.ini_options]block with one option.conftest.pymoves totests/conftest.pyand loses its twopytest_pluginslines. No source and no workflow changes.What is not proven here
Every measurement is Python 3.11; CI runs the full matrix. A developer who
runs pytest without the
e2eextra now gets an unknown-plugin error from-prather than a missing-fixture error; the previous unconditionalpytest_pluginsfailed in that setup too, so this is the same contract, not anew one.
Part of the root-conftest class under T-6508, which follows the
organisation-wide sweep in T-6377.
🤖 Generated with Claude Code