Skip to content

Fix platform-dependent TMD valley test; add opt-in fragile-test probe - #1

Merged
cpoli merged 1 commit into
masterfrom
fix/fragile-tests
Nov 21, 2026
Merged

cpoli merged 1 commit into
masterfrom
fix/fragile-tests

Conversation

@cpoli

@cpoli cpoli commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix test_tmd_three_band (failing on Linux CI). It located the K/K′ Berry-curvature peaks with argmin/argmax, but the two plaquettes on either side of each valley tie to rounding (~1e-15), so the winning index was (20, 10) on macOS and (19, 9) on Linux. The test now checks that the curvature at the expected plaquettes equals the min/max, plus the sign and the existing ±symmetry check. Library results were correct; no CHANGELOG entry.
  • Add tests/fragile_probe.py, opt-in via pytest tests/ --fragile. Flags np.argmax/argmin/argsort called from test code on float data whose deciding values tie within 1e-9 (relative), and exact assertEqual on non-integer floats. Prints a "fragile probe" section at the end of the run; off by default, so normal runs and CI are unchanged.

Audit

Ran the full suite with the probe. The 9 remaining candidates were each checked and are benign (ties among degenerate values compared only as values, peaks with ≥2e-5 relative margin, exact comparisons of parsed constants or the same code path). Limits: it only sees ties present on the machine it runs on, and cannot intercept array-method calls like x.argmin().

Test plan

  • pytest tests/ — 891 passed, 9 skipped
  • pytest tests/ --fragile — same, with the probe report
  • CI on Linux (Python 3.10–3.14)

🤖 Generated with Claude Code

test_tmd_three_band located the K/K' Berry-curvature peaks with
argmin/argmax, but the plaquettes on either side of each valley tie to
rounding (~1e-15), so the index differed between macOS and Linux CI.
Compare the curvature at the expected plaquettes with the extrema instead.

tests/fragile_probe.py (enabled with `pytest tests/ --fragile`) flags
test-side argmax/argmin/argsort near-ties and exact non-integer float
assertEqual calls, to catch this class of failure locally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 21, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@cpoli
cpoli merged commit 43b40d3 into master Nov 21, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant