Skip to content

Commit 3ee503a

Browse files
authored
Merge pull request #2 from Query-farm/coverage-testing
Coverage testing
2 parents 59d839c + d4d84ed commit 3ee503a

8 files changed

Lines changed: 700 additions & 2 deletions

File tree

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ wheels/
1212
# Mypy reports
1313
mypy-reports/
1414
mypy-html-report/
15+
16+
# Coverage artifacts
17+
.coverage
18+
.coverage.*
19+
htmlcov/

CLAUDE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ uv run pytest # Run tests
1010
uv run ruff check . # Lint
1111
uv run ruff format . # Format
1212
uv run mypy vgi/ # Type check
13+
14+
# Run tests with coverage (includes subprocess/worker coverage)
15+
uv run coverage run -m pytest --no-cov
16+
uv run coverage combine # Merge subprocess coverage data
17+
uv run coverage report # Show coverage report
18+
uv run coverage html # Generate HTML report in htmlcov/
1319
```
1420

1521
**Before committing**, always run lint and format checks:

pyproject.toml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,42 @@ ignore_missing_imports = true
4646
addopts = "--mypy --ruff"
4747
testpaths = ["tests"]
4848

49+
[tool.coverage.run]
50+
# Enable subprocess coverage - automatically patches subprocess.Popen
51+
# to inject coverage measurement into spawned worker processes
52+
patch = ["subprocess"]
53+
# Each subprocess writes to its own data file (.coverage.<hostname>.<pid>)
54+
parallel = true
55+
# Handle SIGTERM gracefully (writes coverage data before exit)
56+
sigterm = true
57+
# Measure branch coverage
58+
branch = true
59+
# What to measure
60+
source = ["vgi"]
61+
# Omit test files and examples from coverage
62+
omit = [
63+
"vgi/examples/*",
64+
"tests/*",
65+
]
66+
67+
[tool.coverage.report]
68+
# Fail if coverage drops below this threshold
69+
fail_under = 80
70+
# Show missing lines in the report
71+
show_missing = true
72+
# Exclude common patterns from coverage
73+
exclude_lines = [
74+
"pragma: no cover",
75+
"if TYPE_CHECKING:",
76+
"if __name__ == .__main__.:",
77+
"@overload",
78+
"raise NotImplementedError",
79+
"\\.\\.\\.", # Ellipsis in stub files
80+
]
81+
82+
[tool.coverage.html]
83+
directory = "htmlcov"
84+
4985
[dependency-groups]
5086
dev = [
5187
"lxml>=6.0.2",

tests/client/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Client tests package."""

0 commit comments

Comments
 (0)