Testing and pull requests
Use this page for test conventions and review-ready change expectations.
Testing conventions
- Use
pytestfor unit tests. - Use
pytest-asynciofor async tests. - Use
pytest-covfor coverage when needed. - Name tests with the pattern:
test_<what>_<condition>_<expected_result> - Mock external dependencies with
pytest-mock. - For bridge, transport, and protocol work, add parity tests that compare the canonical command/event vocabulary with handlers, encoders, fixtures, and any downstream decoder registry. Drift should fail loudly in tests.
- Add at least one representative fixture for every public protocol event or command shape. Keep fixtures small and hand-auditable unless a real generator owns them.
Fixture placement
- Prefer shared fixtures in
conftest.py. - Use
@pytest.fixture(name="<name>")to avoidredefined-outer-namewarnings. - Name fixture functions as
fixture_<name>.
Example:
@pytest.fixture(name="my_fixture")
def fixture_my_fixture() -> MyType:
return MyType()
Pull request expectations
- Add tests when the change needs them.
- Update documentation when the public behavior or workflow changes.
- Run
/usr/bin/make format. - Run
/usr/bin/make lint. - Run the full test suite.
- Do not mention “Co-Authored” or “Authored By” in commit or PR text.
Commit messages
- Keep commit messages concise.
- Use the imperative mood.
- Prefer small, focused commits.