Skip to content

Commit 574585f

Browse files
igerberclaude
andcommitted
Fix global bootstrap NaN SE test to disable Rust backend
The test patches _fit_joint_with_fixed_lambda to force failures, but on CI with Rust available, the Rust bootstrap path runs instead of the Python fallback. Disable Rust backend in the test to exercise the Python return path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9d4c80c commit 574585f

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

tests/test_trop.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3583,6 +3583,7 @@ class TestTROPBootstrapNaNSE:
35833583
def test_global_bootstrap_zero_draws_returns_nan_se(self):
35843584
"""Global bootstrap with 0 successful draws returns NaN SE, not 0.0."""
35853585
from unittest.mock import patch
3586+
import sys
35863587

35873588
df = TestTROPNValidTreated._make_panel()
35883589

@@ -3595,8 +3596,12 @@ def test_global_bootstrap_zero_draws_returns_nan_se(self):
35953596
seed=42,
35963597
)
35973598

3598-
# Patch _fit_joint_with_fixed_lambda to always raise (all bootstrap iters fail)
3599-
with patch.object(TROP, '_fit_joint_with_fixed_lambda',
3599+
# Disable Rust backend so Python fallback path is tested,
3600+
# then patch _fit_joint_with_fixed_lambda to always raise
3601+
trop_module = sys.modules['diff_diff.trop']
3602+
with patch.object(trop_module, 'HAS_RUST_BACKEND', False), \
3603+
patch.object(trop_module, '_rust_bootstrap_trop_variance_joint', None), \
3604+
patch.object(TROP, '_fit_joint_with_fixed_lambda',
36003605
side_effect=ValueError("forced failure")):
36013606
with warnings.catch_warnings():
36023607
warnings.simplefilter("ignore")

0 commit comments

Comments
 (0)