CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/pytest-api-testing

Pytest patterns for Python APIs -- httpx AsyncClient, conftest fixtures, database isolation, parametrize edge cases, error response testing, auth flows, factory fixtures

99

1.23x
Quality

99%

Does it follow best practices?

Impact

100%

1.23x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

pytest-tests-created.jsonverifiers/

{
  "instruction": "Create API tests with pytest and httpx",
  "relevant_when": "Agent builds a Python/FastAPI API",
  "context": "Tests should use pytest with httpx AsyncClient against the FastAPI app. Fixtures belong in conftest.py. Database state must be isolated between tests. Error responses (404, 422) must be tested, not just happy paths.",
  "sources": [
    {
      "type": "file",
      "filename": "skills/pytest-api-testing/SKILL.md",
      "tile": "tessl-labs/pytest-api-testing"
    }
  ],
  "checklist": [
    {
      "name": "test-file-exists",
      "rule": "Agent creates test files (test_*.py) in a tests/ directory",
      "relevant_when": "Agent builds a Python API"
    },
    {
      "name": "test-client-configured",
      "rule": "Agent configures an httpx AsyncClient with ASGITransport (for FastAPI) or Flask test_client for API testing, as a fixture in tests/conftest.py",
      "relevant_when": "Agent sets up Python API tests"
    },
    {
      "name": "database-isolation",
      "rule": "Agent includes a database reset or isolation mechanism (autouse fixture, transaction rollback, or table truncation) so tests do not leak state",
      "relevant_when": "Agent writes tests for an API with a database"
    },
    {
      "name": "error-responses-tested",
      "rule": "Agent writes at least one test for an error response (404, 422, 400, or 401) in addition to happy-path tests",
      "relevant_when": "Agent writes API endpoint tests"
    },
    {
      "name": "response-body-asserted",
      "rule": "Tests assert the response JSON body structure (checking for expected keys or values), not just HTTP status codes",
      "relevant_when": "Agent writes API test assertions"
    }
  ]
}

tile.json