Skip to content

fix(tests): load the fixtures through addopts, not a root conftest - #42

Merged
JarbasAl merged 1 commit into
devfrom
fix/t6508-fixtures-load-without-a-root-conftest
Oct 1, 2026
Merged

JarbasAl merged 1 commit into
devfrom
fix/t6508-fixtures-load-without-a-root-conftest

Conversation

@openvoiceos-bot

Copy link
Copy Markdown
Contributor

The defect

A conftest.py at the repository ROOT makes pytest put the root on
sys.path. The root holds a second copy of hivemind_cli_terminal and that
copy wins the import, so build_tests installs a wheel it never tests: a
packaging defect cannot fail it.

This is the half of the tests/__init__.py class that deleting a marker file
does 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_plugins cannot move down: pytest refuses that key in a non-top-level
conftest. hivescope's fixtures now load through -p hivescope.pytest_fixtures
in [tool.pytest.ini_options] addopts — the same plugin, loaded the same way,
with no file at the root.

The pytest_terminal_summary hook needs no top-level conftest, so it moves
into tests/ unchanged.

The measurement

Built on dev 0a712e3 with uv build, 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 build_tests and
coverage both pass.

cell result
root conftest, clean 19 passed, 1 skipped, 1 xfailed, 1 xpassed
root conftest, working tree poisoned 1 error during collection
addopts, clean 19 passed, 1 skipped, 1 xfailed, 1 xpassed
addopts, working tree poisoned 19 passed, 1 skipped, 1 xfailed, 1 xpassed

The control for each workflow that loads fixtures

Two workflows run pytest here, build_tests and coverage, and both pass the
e2e extra and the tests/ 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:

======================= XPASS — flip these xfail markers =======================
  XPASS  tests/e2e/test_bridge1_conformance.py::test_fifo_order_relay_chain

Surface

pyproject.toml gains a [tool.pytest.ini_options] block with one option.
conftest.py moves to tests/conftest.py and loses its two
pytest_plugins lines. 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 e2e extra now gets an unknown-plugin error from
-p rather than a missing-fixture error; the previous unconditional
pytest_plugins failed in that setup too, so this is the same contract, not a
new one.

Part of the root-conftest class under T-6508, which follows the
organisation-wide sweep in T-6377.

🤖 Generated with Claude Code

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

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: e61bf451-603f-4214-9c38-f47f7dc947f5

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-advanced-security

Copy link
Copy Markdown

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:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@github-actions github-actions Bot added the fix label Sep 28, 2026
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

The results of your automated verification are here! 📜

I've aggregated the results of the automated checks for this PR below.

🏷️ Release Preview

Ensuring our release notes are clear and concise. ✍️

Current: 1.0.1a2 → Next: 1.0.1a3

Signal Value
Label (none)
PR title fix(tests): load the fixtures through addopts, not a root conftest
Bump alpha

⚠️ No conventional commit prefix — alpha-only bump.
Suggested: fix: update the thing or feat: update the thing


🚀 Release Channel Compatibility

Predicted next version: 1.0.1a3

Channel Status Note Current Constraint
Stable ⚪ Not in channel -
Testing ⚪ Not in channel -
Alpha ⚪ Not in channel -

📋 Repo Health

Giving the repo a clean bill of health! 🛁

✅ All required files present.

Latest Version: 1.0.1a2

✅ hivemind_cli_terminal/version.py — Version file
✅ README.md — README
✅ LICENSE — License file
✅ pyproject.toml — pyproject.toml
⚠️ setup.py — setup.py
✅ CHANGELOG.md — Changelog
✅ hivemind_cli_terminal/version.py has valid version block markers

🔍 Lint

Another day, another successful automated run. 🌅

✅ ruff: no issues in 14 file(s)
✅ actionlint: 10 workflow file(s), no finding

📊 Coverage

A forensic look at what's being executed. 🔎

❌ 27.5% total coverage

Per-file coverage (3 files)
File Coverage Missing lines
hivemind_cli_terminal/__main__.py 0.0% 40
hivemind_cli_terminal/version.py 0.0% 5
hivemind_cli_terminal/__init__.py 46.9% 34

Full report: download the coverage-report artifact.

⚖️ License Check

I'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 Tests

The build pipeline has reached its destination. 📍

✅ All versions pass

Python Build Install Tests pytest
3.10 ✅ ✅ ✅ 19 passed, 1 skipped, 1 xfailed, 1 xpassed, 167 warnings in 32.99s
3.11 ✅ ✅ ✅ 19 passed, 1 skipped, 1 xfailed, 1 xpassed, 167 warnings in 22.20s
3.12 ✅ ✅ ✅ 19 passed, 1 skipped, 1 xfailed, 1 xpassed, 167 warnings in 22.53s
3.13 ✅ ✅ ✅ 19 passed, 1 skipped, 1 xfailed, 1 xpassed, 167 warnings in 28.16s

Standard Automated Signature v2.0 🏷️

@JarbasAl
JarbasAl marked this pull request as ready for review October 1, 2026 10:06
@JarbasAl
JarbasAl merged commit f1c7dc6 into dev Oct 1, 2026
13 checks passed
@JarbasAl
JarbasAl deleted the fix/t6508-fixtures-load-without-a-root-conftest branch October 1, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants