---
paths:
  - "**/*.py"
  - "**/*.pyi"
---
# Python Testing

> This file extends `common/testing.md` with Python-specific content.

## Framework

Use the test framework and environment manager configured by the repository. For projects already using pytest, keep new tests consistent with pytest conventions; do not migrate a unittest-based suite without an explicit requirement.

## Coverage

Run the repository's configured coverage command. In a pytest project with pytest-cov already installed, the underlying arguments may resemble `pytest --cov=src --cov-report=term-missing`; invoke them through the project's package or environment manager.

## Test Organization

Use `pytest.mark` for test categorization:

```python
import pytest

@pytest.mark.unit
def test_calculate_total():
    ...

@pytest.mark.integration
def test_database_connection():
    ...
```

## Optional Skill

Load a matching available testing skill when the current Pi session exposes one and the task benefits from it. Do not assume a named Python testing skill or pytest plugin is installed.
