Skip to content

test: stop shipping the git_repo fixture in the tests bundle - #1389

Merged
tschm merged 1 commit into
mainfrom
unship-git-repo-fixture
Jul 10, 2026
Merged

test: stop shipping the git_repo fixture in the tests bundle#1389
tschm merged 1 commit into
mainfrom
unship-git-repo-fixture

Conversation

@tschm

@tschm tschm commented Jul 10, 2026

Copy link
Copy Markdown
Member

Problem

The tests bundle shipped a self-contained, self-testing trio to every consumer repo:

  • the git_repo fixture (in bundles/tests/.rhiza/tests/conftest.py),
  • its only consumer, test_git_repo_fixture.py,
  • test_utils.py, whose GIT export only that fixture used (its run_make/strip_ansi/setup_rhiza_git_repo helpers were never used inside the bundle).

None of it is usable by consumers — it exists purely to test itself, so it lands as dead code in every downstream project. This surfaced in jquantstats, which had to strip the fixture, test_utils.py, and the orphaned test_git_repo_fixture.py after deleting the fixture test, diverging from the template.

Change

Relocate the git-repo machinery into rhiza's own tests/ suite (so rhiza keeps exercising the fixture) and remove it from the bundle that flows down to consumers:

File Change
bundles/tests/.rhiza/tests/conftest.py Keep only root + logger fixtures
bundles/tests/.rhiza/tests/test_utils.py Deleted (helpers already live in tests/util.py; unused in the bundle)
bundles/tests/.rhiza/tests/test_git_repo_fixture.pytests/test_git_repo_fixture.py Moved out of the bundle
tests/conftest.py Gains the git_repo fixture + mock uv/make scripts
.rhiza/tests/{test_utils,test_git_repo_fixture}.py Removed now-dangling symlinks
bundles/tests/.rhiza/tests/README.md Updated to drop the removed files/fixture

Consumers now receive a lean bundle: pyproject/readme/docstring tests plus the root/logger fixtures.

Verification

  • Relocated fixture test + bundle suite: 45 passed, 2 skipped (uv run --group test pytest tests/test_git_repo_fixture.py .rhiza/tests)
  • Full tests/ tree collects cleanly: 1341 tests, no import errors

🤖 Generated with Claude Code

The tests bundle shipped a self-contained, self-testing trio to every
consumer repo — the git_repo fixture (in conftest.py), its only consumer
test_git_repo_fixture.py, and test_utils.py (whose GIT export only the
fixture used). None of it is usable by consumers: it exists purely to
test itself, so it lands as dead code in every downstream project (e.g.
jquantstats had to strip it after deleting the fixture test).

Relocate the git_repo fixture and its self-test into rhiza's own tests/
suite so rhiza keeps exercising the fixture, and remove them from the
bundle:

- bundles/.../conftest.py: keep only the root + logger fixtures
- bundles/.../test_utils.py: deleted (helpers already exist as
  tests/util.py for rhiza's own suite; unused inside the bundle)
- bundles/.../test_git_repo_fixture.py -> tests/test_git_repo_fixture.py
- tests/conftest.py: gains the git_repo fixture + mock uv/make scripts
- drop the now-dangling .rhiza/tests symlinks and update the bundle README

Consumers now receive a lean bundle (pyproject/readme/docstring tests
plus root/logger fixtures). Verified: relocated fixture test + bundle
suite pass (45 passed, 2 skipped); full tests/ tree collects cleanly
(1341 tests).

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR trims the downstream-shipped tests bundle by removing the self-testing git_repo fixture and its utilities from the bundle, while keeping rhiza’s own test coverage by relocating the fixture/test into the mother-repo tests/ suite.

Changes:

  • Removed git_repo + related helpers from bundles/tests/.rhiza/tests, keeping only root/logger fixtures for consumers.
  • Moved the git_repo fixture test to tests/test_git_repo_fixture.py and added a git_repo fixture implementation to tests/conftest.py.
  • Updated the bundled .rhiza/tests README to reflect the slimmer bundle contents.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/test_git_repo_fixture.py Updates module docstring to clarify the fixture is rhiza-internal and not shipped in the bundle.
tests/conftest.py Adds an internal git_repo fixture and mock uv/make scripts to support rhiza’s own integration-style tests.
bundles/tests/.rhiza/tests/test_utils.py Deletes bundle-only helper module that was only used by the removed fixture/test.
bundles/tests/.rhiza/tests/README.md Removes references to the removed fixture/test_utils from bundle documentation.
bundles/tests/.rhiza/tests/conftest.py Removes git_repo fixture and related machinery; retains root and logger.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/conftest.py
Comment on lines +138 to +142
@pytest.fixture
def git_repo(root, tmp_path, monkeypatch):
"""Sets up a remote bare repo and a local clone with necessary files."""
remote_dir = tmp_path / "remote.git"
local_dir = tmp_path / "local"
Comment thread tests/conftest.py
Comment on lines +19 to +28
# Get absolute path for git to avoid S607 warnings
GIT = shutil.which("git") or "/usr/bin/git"

MOCK_MAKE_SCRIPT = """#!/usr/bin/env python3
import sys

if len(sys.argv) > 1 and sys.argv[1] == "help":
print("Mock Makefile Help")
print("target: ## Description")
"""
@tschm
tschm merged commit 4c1561d into main Jul 10, 2026
63 checks passed
@tschm
tschm deleted the unship-git-repo-fixture branch July 10, 2026 05:33
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