You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if echo "$CHANGED" | grep -qE '^(policyengine_us_data/|modal_app/|tests/integration/)'; then
195
+
if echo "$CHANGED" | grep -qE '^(\.github/scripts/|\.github/workflows/pr\.yaml|modal_app/|policyengine_us_data/|tests/integration/|tests/support/|pyproject\.toml|uv\.lock)'; then
Copy file name to clipboardExpand all lines: CLAUDE.md
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,25 +7,33 @@
7
7
8
8
## Testing
9
9
10
+
Canonical testing guidance lives in `docs/engineering/skills/testing.md`. If
11
+
this file conflicts with that skill, follow the skill and update this adapter.
12
+
10
13
### Running Tests
11
14
-`make test-unit` - Run unit tests only (fast, no data dependencies)
12
15
-`make test-integration` - Run integration tests (requires built H5 datasets)
13
16
-`make test` - Run all tests
14
17
-`pytest tests/unit/ -v` - Unit tests directly
15
18
-`pytest tests/integration/test_cps.py -v` - Specific integration test
19
+
-`python scripts/run_quality_guards.py` - Run layout/import quality guards
16
20
17
21
### Test Organization
18
-
Tests are in the top-level `tests/` directory, split into two sub-directories:
22
+
Tests are in the top-level `tests/` directory, split into these sub-directories:
19
23
20
24
-**`tests/unit/`** — Self-contained tests that use synthetic data, mocks, patches, or checked-in fixtures. Run in seconds with no external dependencies.
21
25
-`unit/datasets/` — unit tests for dataset code
22
26
-`unit/calibration/` — unit tests for calibration code
23
27
24
28
-**`tests/integration/`** — Tests that require built H5 datasets, HuggingFace downloads, Microsimulation objects, or database ETL. Named after the dataset they test.
29
+
-**`tests/optimized/`** — Tests that exercise deployed Modal/staging seams.
25
30
26
31
### Test Placement Rules
32
+
-**NEVER** put pytest files under `policyengine_us_data/tests/`; CI does not collect that tree
27
33
-**NEVER** put tests that require H5 files or Microsimulation in `unit/`
28
34
-**NEVER** put tests that use only synthetic data or mocks in `integration/`
35
+
-**NEVER** import from `tests.conftest`; fixtures are discovered automatically and helper functions belong in local support modules
36
+
-**NEVER** import helpers across test lanes, such as `tests.unit` from an integration test
29
37
- Integration test files are named after their dataset dependency: `test_cps.py` tests `cps_2024.h5`
30
38
- Sanity checks (value ranges, population counts) belong in the per-dataset integration test file, not in a separate sanity file
31
39
- When adding a new integration test, add it to the existing per-dataset file if one exists
0 commit comments