Flatten Repo Testing
Scope
Use this skill for pytest organization, markers, defaults, and test quality.
Rules
- Test layout:
tests/unit/flatten_repo/for unit tests.tests/integration/for integration tests.tests/end2end/for end-to-end tests.
- Marker strategy:
- Unit:
unit - Integration:
integration - End-to-end:
end2end
- Unit:
- Auto-tag tests from directory with
tests/conftest.pycollection hooks. - Default run must execute only unit tests via pytest addopts (
-m unit). - Keep tests deterministic and filesystem-local (no network).
- Prefer function-based tests over class/object-based tests.
- Keep imports at the top of test files, never inside test functions.
- For mocking, use
pytest_mock.MockerFixtureand themockerfixture instead ofunittest.mock. - For CLI changes, include tests for both behavior and UX flags (
--help,--versionwhen relevant).
Validation
Run:
uv run pytestuv run pytest -m integrationuv run pytest -m end2end
Converted and distributed by TomeVault — claim your Tome and manage your conversions.