chore: remove pytest-xdist parallel test infrastructure and switch to serial execution

This commit is contained in:
2026-06-12 05:43:33 +00:00
parent 1e2f304935
commit 425e9bdca1
8 changed files with 30 additions and 45 deletions
+4 -6
View File
@@ -633,14 +633,12 @@ A member may delete only their own content, but an **administrator may delete an
- **849+ tests** across 63 files: Playwright integration + in-process unit tests
- Playwright (NOT pytest-playwright plugin - conflicts, uninstall it)
- Runs in parallel via pytest-xdist (`make test` = `-n auto --dist loadfile`); each worker is an isolated uvicorn subprocess on port 10501+ with its own temp database and `DEVPLACE_DATA_DIR`
- `loadfile` keeps every test in a file on one worker so session fixtures and ordering hold; cap workers with `make test TEST_WORKERS=4`
- `make test-serial` runs everything in one process for debugging
- Runs serially, one test at a time, in a single process (`make test`); the suite drives one uvicorn subprocess on port 10501 with its own temp database and `DEVPLACE_DATA_DIR`
- Serial execution is enforced in `pyproject.toml` (`[tool.pytest.ini_options]` `addopts = "--tb=line -p no:xdist"`), so concurrent runs cannot be turned on by accident
- Test users `alice_test` / `bob_test` seeded via HTTP at session start
- Tests stop at first failure (`-x` flag)
- Failure screenshots auto-save to `/tmp/devplace_test_screenshots/`
- Headed mode: `make test-headed` (parallel, one Chromium window per worker); `make test-headed-serial` for a single window
- Cap headed windows the same way: `make test-headed TEST_WORKERS=2`
- Headed mode: `make test-headed` (a single Chromium window)
### Key test patterns
@@ -721,7 +719,7 @@ The app runs correctly under multiple Uvicorn workers (independent processes sha
Gitea Actions workflow at `.gitea/workflows/test.yaml`:
- Runs on push/PR to `master`
- Sets up Python 3.13, installs dependencies + Playwright Chromium
- Runs the full test suite under coverage in parallel (`coverage run -m pytest -n auto --dist loadfile`); `.coveragerc` `parallel=true` lets the per-worker `.coverage.*` files combine
- Runs the full test suite serially under coverage (`coverage run -m pytest tests/`); `.coveragerc` `parallel=true` lets the app's uvicorn subprocess write its own `.coverage.*` file, which `coverage combine` merges with the test-process data
- Builds and publishes the coverage HTML as an artifact on every run
- Uploads failure screenshots as artifacts when a test fails