Testing
DeepTab uses pytest with pytest-cov for test coverage. The test suite runs against all supported Python versions and operating systems on every push and pull request.
Running the test suite
Goal |
Command |
|---|---|
Full suite with coverage |
|
A single file |
|
A single test |
|
Live logs, stop on first fail |
|
just test expands to poetry run pytest --cov=deeptab tests/.
Writing new tests
Convention |
Guideline |
|---|---|
Location |
Place tests in |
Variations |
Use |
Data |
Use small synthetic datasets ( |
Trainer noise |
Silence Lightning output with |
import pytest
@pytest.mark.parametrize("n_layers", [1, 2, 4])
def test_depth(n_layers):
...
Coverage
A coverage report is printed after every just test run. For an interactive HTML report:
poetry run pytest --cov=deeptab --cov-report=html tests/
open htmlcov/index.html
The full suite also runs in CI across every supported Python and OS combination. See CI/CD for the matrix.
Pre-push checks
The pre-commit configuration includes a push-stage hook that runs pyright type checking before git push. This is installed automatically by just install. To run it manually:
just check
The full test suite is not part of the push hook; it runs in CI on every push and pull request. Run just test locally before pushing if your change touches model or training code.