--situ/--affected emit run="python3 <file>" for Django/pytest test modules, which cannot be run that way
- Dominant language
- C++
- Stars
- 2.1k
- Forks
- 125
- Avg merge
- 5h 42m
- Merged PRs (30d)
- 136
Description
## What is wrong
`--situ` (and `--affected` under it) emits a `run=""` hint per test file. On a Django repo the hint is:
```
scheduler/tests/scheduler/test_smart_schedules.py [partner] [hops=1] (run: python3 scheduler/tests/scheduler/test_smart_schedules.py)
scheduler/tests/scheduler/test_battery_warming_schedules.py [hops=1] (run: python3 scheduler/tests/scheduler/test_battery_warming_schedules.py)
```
`python3 ` does not run a Django `TestCase` module. It imports Django models at module level with no settings configured and fails with `ImproperlyConfigured`. The correct runner is `pytest ` (a `pytest.ini`/`conftest.py` is present at the repo root) or `./manage.py test `.
The `ripwire-change-check` skill says "no `run=` means not derivable, never treat its absence as no runner". A wrong `run=` is worse than an absent one: an agent pastes it, gets a settings error, and may conclude the test is broken.
## Environment
ripwire 0.6.0 (built_from=2d2f10e62), macOS arm64. Django monolith, tests under `/tests/**/test_*.py`, `conftest.py` and `pytest.ini` at repo root.
## Suggestion
For Python test files, only emit `run=` when a runner is actually evidenced:
- `pytest.ini`, `pyproject.toml [tool.pytest.ini_options]`, `conftest.py`, or `setup.cfg [tool:pytest]` present at or above the test's directory: `run="pytest "`.
- `manage.py` present and the file imports `django`: `run="python manage.py test "`.
- Neither, and the file has no `if __name__ == "__main__"` block: omit `run=` rather than defaulting to `python3 `.
The same "is this file directly executable" check would also fix the hint for `unittest` modules without a main guard.
Contributor guide
Research direction
Trace the --situ and --affected entry points, then read the ripwire-change-check skill and inspect how run= hints are derived. Use pytest.ini, conftest.py, manage.py, and the referenced Django test modules as evidence cases; done means pytest or manage.py test is suggested when supported, and run= is omitted when no direct runner is evidenced.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- cli, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100