Skip to content

perf: run TestSuiteGate pytest from project root with correct interpreter #141

@omsherikar

Description

@omsherikar

Summary

TestSuiteGate invokes python3 -m pytest with cwd=str(file_path.parent) (the changed file directory), not project_root. That can break collection (conftest.py, pytest.ini, pyproject.toml [tool.pytest], PYTHONPATH) and forces odd layout assumptions. It also hard-codes python3 instead of sys.executable, which can mismatch the environment running Refactron.

Suggested direction

  • Use sys.executable and set cwd to project_root when available; fall back safely when project_root is None.
  • Optionally pass through pytest args from config (markers, timeout) to avoid redundant subprocess cold starts where possible.

Acceptance

  • Pytest runs with the same interpreter as the host process and discovers config from repo root in typical layouts.
  • Existing tests updated or added to cover root vs nested file paths.

Code

  • refactron/verification/checks/test_gate.pysubprocess.run / cmd construction

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions