Skip to main content
Learn how to run the test suite, write new tests with pytest markers and fixtures, check coverage, and integrate tests into CI/CD pipelines.

Running Tests

All Tests

With Coverage

Quick Smoke Test

Verbose Output

Test Selection

By File

By Pattern

By Marker

Single Test

Test Markers

Registered markers:
Note: These five markers are registered in pyproject.toml. Using unregistered markers will cause warnings with --strict-markers. Slow tests are skipped by default; run them explicitly with pytest -m slow.

Test Structure

Directory Layout

tests
conftest.py
test_spellchecker.py
test_validators_edge_cases.py
test_sqlite_provider.py
test_symspell.py
test_ngram_*.py
test_viterbi.py
integration
test_config_loading.py
test_cli_stdin_stdout.py
e2e
test_cli_e2e.py
test_robustness.py
fixtures
config_templates.py
myanmar_test_samples.py
benchmarks

Naming Conventions

Fixtures

Common Fixtures (conftest.py)

Fixture Scope

Writing Tests

Basic Test

Parameterized Tests

Exception Testing

Async Tests

pytest-asyncio must be installed separately (pip install pytest-asyncio) as it is not included in the dev dependencies.

Mock Testing

Test Data

Loading Test Data

Myanmar Test Samples

Coverage Requirements

The project requires ≥75% code coverage:

Excluding Code from Coverage

Performance Testing

Benchmarks

Running Benchmarks

CI/CD Integration

GitHub Actions Example

Troubleshooting

Tests Not Found

Fixture Not Found

Slow Tests

See Also