[test][workflow] Pin project pytest runner and exclude branches worktrees from collection #738

Open
opened 2026-07-17 22:51:51 -05:00 by jcwalker3 · 0 comments
Owner

Problem

Running bare pytest from the Gitea-Tools control checkout recursively discovers tests inside branches/ worktrees. Multiple copies of tests/conftest.py are imported under the same module name, producing ImportPathMismatchError and large cascading collection-error counts.

The shell also resolves different interpreters:

  • python3 → Python 3.13
  • bare pytest → Python 3.14
  • project venv → its own pinned Python and pytest

This makes test results dependent on PATH and the number of registered worktrees, which is unsafe for autonomous LLM workers.

Expected behavior

The repository must provide one canonical, isolated test command that:

  • uses the project virtual environment;
  • collects only the intended tests/ directory;
  • never enters branches/ sibling worktrees;
  • behaves identically from the control checkout and a dedicated issue worktree;
  • does not depend on shell aliases or a globally installed pytest.

Acceptance criteria

  • Inspect and update the existing pytest configuration rather than creating conflicting configuration files.
  • Set canonical test discovery to tests/.
  • Exclude branches/, venv/, .git/, caches, generated files, and other non-source trees.
  • Provide a repository-owned test command using:
    ./venv/bin/python3 -m pytest tests
  • Add a regression check proving branches/*/tests is excluded from control-checkout collection.
  • Verify collection from the clean control checkout.
  • Verify collection from a dedicated branches/ worktree.
  • Run the full suite through the project venv.
  • Document the canonical command for all LLM workflows.
  • Do not delete or modify existing worktrees.

Readiness proof context

Prerequisite #735 (PR #737) landed and MCP was restarted at merge SHA 29d96c8946 so native create_issue can target Gitea-Tools without wrong_repo.

## Problem Running bare pytest from the Gitea-Tools control checkout recursively discovers tests inside branches/ worktrees. Multiple copies of tests/conftest.py are imported under the same module name, producing ImportPathMismatchError and large cascading collection-error counts. The shell also resolves different interpreters: - python3 → Python 3.13 - bare pytest → Python 3.14 - project venv → its own pinned Python and pytest This makes test results dependent on PATH and the number of registered worktrees, which is unsafe for autonomous LLM workers. ## Expected behavior The repository must provide one canonical, isolated test command that: - uses the project virtual environment; - collects only the intended tests/ directory; - never enters branches/ sibling worktrees; - behaves identically from the control checkout and a dedicated issue worktree; - does not depend on shell aliases or a globally installed pytest. ## Acceptance criteria - Inspect and update the existing pytest configuration rather than creating conflicting configuration files. - Set canonical test discovery to tests/. - Exclude branches/, venv/, .git/, caches, generated files, and other non-source trees. - Provide a repository-owned test command using: ./venv/bin/python3 -m pytest tests - Add a regression check proving branches/*/tests is excluded from control-checkout collection. - Verify collection from the clean control checkout. - Verify collection from a dedicated branches/ worktree. - Run the full suite through the project venv. - Document the canonical command for all LLM workflows. - Do not delete or modify existing worktrees. ## Readiness proof context Prerequisite #735 (PR #737) landed and MCP was restarted at merge SHA 29d96c8946689be2fc9a55d296e4383a3aa03c4f so native create_issue can target Gitea-Tools without wrong_repo.
jcwalker3 added the status:readytype:bug labels 2026-07-17 22:51:51 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Scaled-Tech-Consulting/Gitea-Tools#738