Public Access
DEVX-129: feat: test isolation pytest plugin, shift-left quality gates, dep upgrades
This commit was merged in pull request #195.
This commit is contained in:
@@ -334,6 +334,35 @@ devx tools check-test-speed --max-seconds 10
|
||||
devx tools check-test-speed --max-seconds 4 --max-single-seconds 0.5
|
||||
```
|
||||
|
||||
### `devx tools check-test-isolation`
|
||||
|
||||
Statically analyze test files for un-hermetic patterns that cause slow
|
||||
or flaky tests. Also available as a **pytest plugin** (auto-discovered
|
||||
via the `pytest11` entry point when devx is installed — runs
|
||||
automatically on every `pytest` invocation).
|
||||
|
||||
Detected patterns:
|
||||
|
||||
- **unpatched-subprocess**: `subprocess.run/call/Popen/check_call/check_output`
|
||||
called in a test function without `@patch`
|
||||
- **unpatched-sleep**: `time.sleep` called without `@patch`
|
||||
- **unpatched-helper**: known subprocess-spawning helpers (`update_doc_versions`,
|
||||
`run_cmd`, `run_tests`) called without `@patch` or patching their internal deps
|
||||
- **excessive-iterations**: `for _ in range(N)` where N > 100
|
||||
|
||||
```bash
|
||||
devx tools check-test-isolation
|
||||
devx tools check-test-isolation --test-path tests/ --strict
|
||||
devx tools check-test-isolation --categories unpatched-subprocess,unpatched-sleep
|
||||
devx tools check-test-isolation --max-loop-iterations 50
|
||||
```
|
||||
|
||||
Pytest plugin options (automatic when devx is installed):
|
||||
|
||||
- `--strict-test-isolation` — fail the test run on violations
|
||||
- `--no-test-isolation` — disable analysis for this run
|
||||
- `--test-isolation-max-loop N` — max iterations per loop (default: 100)
|
||||
|
||||
### `devx tools configure-repo`
|
||||
|
||||
Configure repository: branch protection and labels via the Gitea REST API.
|
||||
|
||||
Reference in New Issue
Block a user