Testing
Running Tests
Run the full test suite with parallel execution and coverage:
pytest -n auto --cov
Run a single test file:
pytest tests/test_url_utils.py -v
Run with coverage report:
pytest --cov --cov-report=html
open htmlcov/index.html
Coverage Target
We target 90% line coverage across the entire codebase.
Writing Tests
All tests live in tests/. We follow TDD (Red-Green-Refactor):
Write a failing test that specifies the expected behavior.
Implement the minimum code to make the test pass.
Refactor while keeping tests green.
All HTTP interactions are mocked using the responses library — the test
suite must not make real network requests.
Test Structure
Test file |
What it tests |
|---|---|
|
URL normalization, prefix matching, depth |
|
Config loading, YAML parsing, CLI override |
|
URL decision tree, asset type classification |
|
HTTP requests, retries, redirects, SSL |
|
Link extraction, anchor collection |
|
Thread-safe results aggregation |
|
All report sections |
|
End-to-end crawl scenarios |
|
Argument parsing, exit codes |
|
Progress reporter |