Imported from gencau/test-practices-agent-configurations (
dataset/repos/simplistix§testfixtures/AGENTS.md). Install upstream withnpx skills add gencau/test-practices-agent-configurations --skill simplistix§testfixtures. Copyright stays with the author.
Agent Instructions
Principles
- Done means green — a change is only complete when
./happy.shexits 0; do not commit until it does. - No unrelated failures — if
./happy.shfails on something unrelated to your changes, do NOT assume it is a pre-existing problem and proceed anyway. Stop immediately and ask the user how to proceed. - Docs for everything public — new functionality or public API changes must have accompanying docs in
docs/*.rst - Type-annotate public APIs — all public functions and classes need type annotations; mypy is the gate
- Use
compare()in tests — never use bareassertstatements; always usecompare(actual, expected=...)for assertions
Project Overview
Testfixtures is a Python testing utilities library. Features: object comparison with diff output, mocking/replacement, logging capture, temporary directories, datetime mocking, exception/warning testing, Django and Twisted support.
Environment
uv sync --all-extras --all-groups # setup or after pulling
rm -rf .venv && uv sync --all-extras --all-groups # full reset
Commands
./happy.sh # all checks — required before commit
uv run pytest # all tests + doctests
uv run pytest tests/test_comparison.py # single file
uv run pytest --cov=testfixtures --cov-report=term-missing # with coverage
uv run mypy src/testfixtures # type checking
make -C docs html # build docs (use this, not sphinx-build directly)
uv build # build sdist + wheel
Architecture
src/testfixtures/ — all source. Key modules:
comparison.py—compare(),diff(),Comparison,StringComparison,RoundComparison, etc.replace.py—Replacer,replace()decoratorslogcapture.py—LogCapturedatetime.py—mock_datetime,mock_date,mock_timetempdirectory.py— temporary directory managementshouldraise.py—ShouldRaise,should_raiseshouldwarn.py—ShouldWarn,ShouldNotWarndjango.py,twisted.py— framework-specific support__init__.py— main API exports
Config: pyproject.toml (optional deps for Django, Sybil, Twisted).