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.py — subprocess.run / cmd construction
Summary
TestSuiteGateinvokespython3 -m pytestwithcwd=str(file_path.parent)(the changed file directory), notproject_root. That can break collection (conftest.py,pytest.ini,pyproject.toml[tool.pytest], PYTHONPATH) and forces odd layout assumptions. It also hard-codespython3instead ofsys.executable, which can mismatch the environment running Refactron.Suggested direction
sys.executableand setcwdtoproject_rootwhen available; fall back safely whenproject_rootis None.Acceptance
Code
refactron/verification/checks/test_gate.py—subprocess.run/cmdconstruction