Instruction file imported from gesh75/netlog-ai (
.github/instructions/tests.instructions.md). Copyright stays with the author.
Tests
- pytest only. No
unittest.TestCaseclasses in new code. - Name tests
test_<unit>_<scenario>_<expected>so failures read as sentences. - Prefer fixtures over setup/teardown methods; prefer
@pytest.mark.parametrizeover loops. - Every bug fix starts with a regression test that fails before the fix.
- Cover the error paths, not just the happy path: bad input, network failure, empty result, boundary values.
- Never hit the live network. Mock at the client boundary using
monkeypatchorunittest.mock- both are already available. Do not add a new mocking dependency without raising it in the PR first. - Tests must be order-independent. Do not assume execution order or shared mutable state.
- No secrets or real credentials in fixtures - use obviously fake values.