Skip to content

Commit cfc4057

Browse files
authored
Merge pull request #204 from igerber/reduce-python-ci-tests
Reduce TROP test time in pure Python CI
2 parents 1d3f5a5 + 95b61d9 commit cfc4057

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

.github/workflows/rust-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,4 @@ jobs:
177177
PYTHONPATH=. python -c "from diff_diff import HAS_RUST_BACKEND; print(f'HAS_RUST_BACKEND: {HAS_RUST_BACKEND}'); assert not HAS_RUST_BACKEND"
178178
179179
- name: Run tests in pure Python mode
180-
run: PYTHONPATH=. DIFF_DIFF_BACKEND=python pytest tests/ -q --ignore=tests/test_rust_backend.py -n auto --dist worksteal -m ''
180+
run: PYTHONPATH=. DIFF_DIFF_BACKEND=python pytest tests/ -q --ignore=tests/test_rust_backend.py -n auto --dist worksteal

CLAUDE.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,11 @@ category (`Methodology/Correctness`, `Performance`, or `Testing/Docs`):
122122
`threshold = 0.40 if n_boot < 100 else 0.15`.
123123
- **`assert_nan_inference()`** from conftest.py: Use to validate ALL inference fields are
124124
NaN-consistent. Don't check individual fields separately.
125-
- **Slow tests**: TROP, Sun-Abraham bootstrap, and TROP-parity tests are marked
126-
`@pytest.mark.slow` and excluded by default via `addopts`. Run `pytest -m ''`
127-
to include them, or `pytest -m slow` to run only slow tests.
125+
- **Slow tests**: TROP methodology/joint-method tests, Sun-Abraham bootstrap, and
126+
TROP-parity tests are marked `@pytest.mark.slow` and excluded by default via `addopts`.
127+
`test_trop.py` uses per-class markers (not file-level) so that validation, API, and
128+
solver tests still run in the pure Python CI fallback. Run `pytest -m ''` to include
129+
slow tests, or `pytest -m slow` to run only slow tests.
128130
- **Behavioral assertions**: Always assert expected outcomes, not just no-exception.
129131
Bad: `result = func(bad_input)`. Good: `result = func(bad_input); assert np.isnan(result.coef)`.
130132

tests/test_trop.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import pandas as pd
77
import pytest
88

9-
pytestmark = pytest.mark.slow
10-
119
from diff_diff import SyntheticDiD
1210
from diff_diff.trop import TROP, TROPResults, trop
1311
from diff_diff.prep import generate_factor_data
@@ -465,6 +463,7 @@ def test_nan_propagation_when_se_zero(self):
465463
assert results.att == 1.0, "ATT should still be valid"
466464

467465

466+
@pytest.mark.slow
468467
class TestTROPvsSDID:
469468
"""Tests comparing TROP to SDID under different DGPs."""
470469

@@ -543,6 +542,7 @@ def test_convenience_with_kwargs(self, simple_panel_data):
543542
assert isinstance(results, TROPResults)
544543

545544

545+
@pytest.mark.slow
546546
class TestMethodologyVerification:
547547
"""Tests verifying TROP methodology matches paper specifications.
548548
@@ -1260,6 +1260,7 @@ def test_d_matrix_validation_error_message_helpful(self):
12601260
assert "D[t, i] = 1 for all t >= first treatment" in error_msg
12611261

12621262

1263+
@pytest.mark.slow
12631264
class TestCyclingSearch:
12641265
"""Tests for LOOCV cycling (coordinate descent) search."""
12651266

@@ -1348,6 +1349,7 @@ def test_cycling_search_single_value_grids(self, simple_panel_data):
13481349
assert results.lambda_nn == 0.1
13491350

13501351

1352+
@pytest.mark.slow
13511353
class TestPaperConformanceFixes:
13521354
"""Tests verifying fixes for paper conformance issues.
13531355
@@ -2716,6 +2718,7 @@ def test_zero_weights_no_division_error(self):
27162718
assert result.shape == (6, 4), f"Expected (6, 4), got {result.shape}"
27172719

27182720

2721+
@pytest.mark.slow
27192722
class TestTROPJointMethod:
27202723
"""Tests for TROP method='joint'.
27212724

0 commit comments

Comments
 (0)