Pytest patterns for Python APIs -- httpx AsyncClient, conftest fixtures, database isolation, parametrize edge cases, error response testing, auth flows, factory fixtures
99
99%
Does it follow best practices?
Impact
100%
1.23xAverage score across 5 eval scenarios
Passed
No known issues
{
"context": "Tests whether the agent uses factory fixtures (callable pattern) to create test data with varied attributes, and uses @pytest.mark.parametrize to cover multiple invalid input cases without duplicating test functions.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Factory fixture defined",
"description": "conftest.py defines a factory fixture (e.g., create_member) that returns a callable/async callable, not a static pre-created object",
"max_score": 15
},
{
"name": "Factory accepts overrides",
"description": "The factory fixture's inner function accepts **kwargs or keyword arguments so callers can override individual fields",
"max_score": 10
},
{
"name": "Factory used with variations",
"description": "At least one test calls the factory fixture multiple times with different field values (e.g., different emails or names) in the same test",
"max_score": 10
},
{
"name": "parametrize for validation",
"description": "At least one test uses @pytest.mark.parametrize to test multiple invalid payloads (e.g., bad email, blank name, short password) against the same endpoint",
"max_score": 20
},
{
"name": "parametrize covers 3+ cases",
"description": "The parametrize decorator covers at least 3 distinct invalid input cases",
"max_score": 10
},
{
"name": "No hardcoded duplicate data",
"description": "Tests do NOT repeat the same static payload dict across multiple test functions — the factory or parametrize handles data variation",
"max_score": 10
},
{
"name": "Error body asserted",
"description": "At least one parametrize test asserts that the error response body contains 'detail' or 'error' (not just the status code)",
"max_score": 10
},
{
"name": "Duplicate email test",
"description": "There is a test for the duplicate email / 409 scenario",
"max_score": 10
},
{
"name": "Fixtures in conftest",
"description": "All reusable fixtures are placed in tests/conftest.py (not imported manually from conftest in test files)",
"max_score": 5
}
]
}