This guide describes how to test DocGen.
Run all tests:
pytest -vRun tests for a specific module:
pytest tests/cli/ -vRun tests for a specific file:
pytest tests/cli/test_main.py -vpytest --cov=doc_gen --cov-report=term-missingTests are in the tests/ directory:
tests/
├── cli/
├── config/
├── core/
├── services/
└── utils/
# tests/cli/test_main.py
import pytest
from doc_gen.cli.main import app
def test_main_help():
# Test implementation
pass- Use descriptive test names
- Test one thing per test
- Use fixtures for common setup
- Keep tests independent
make d-testmake c-testCheck coverage:
pytest --cov=doc_gen --cov-report=htmlView coverage report:
open htmlcov/index.htmlCompatibility tests run on Python 3.9 and Python 3.14 with the test extra,
which explicitly includes PyYAML for workflow-configuration tests.
Black and Ruff run separately on Python 3.14 with the dev extra so developer
tool requirements cannot break the supported Python 3.9 runtime.
Equivalent local commands are:
pip install -e ".[test]"
make test-ci
# Standard Python 3.14 development environment
pip install -e ".[dev]"
make format-check-ci
make lint-ci
make c-ci