Skip to content

Set up testing infrastructure with pytest-django #5

Description

@robert197

Description

Configure a robust testing setup that Claude Code can use to verify implementations.

Requirements

  • pytest-django as the test runner
  • factory_boy for test data factories
  • pytest-cov for coverage reporting
  • pytest-xdist for parallel test execution
  • Test directory structure mirroring app structure
  • Fixtures for common test scenarios (owner, apartment, inspection)
  • Base test classes for common patterns

Test Structure

tests/
├── conftest.py          # Shared fixtures
├── factories.py         # factory_boy factories
├── accounts/
│   ├── test_models.py
│   └── test_views.py
├── apartments/
├── inspections/
└── reports/

Key Factories

  • OwnerFactory - Creates owner with auth user
  • ApartmentFactory - Creates apartment with owner
  • InspectionFactory - Creates inspection with items
  • InspectorFactory - Creates inspector user

Acceptance Criteria

  • pytest runs and passes with zero tests (setup works)
  • Factories generate valid test data
  • Coverage report generated on test run
  • make test shortcut works

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions