Repository navigation
test: hardening + branch coverage in CI - #65
Merged
neuromechanist merged 2 commits intoJul 7, 2026
Merged
neuromechanist merged 2 commits into
neuromechanist merged 2 commits into
Conversation
Add [tool.coverage] config (branch coverage, omit tests + CLI, exclude pragmas) and pytest-xdist. CI now runs 'pytest -m "not slow" -n auto --cov-fail-under=78' and uploads the HTML report as an artifact. Parallel branch-cov local run is 2m59s vs 4m31s serial-no-cov (14 cores). Fix a test-isolation bug the parallelism surfaced: TestAMICA used a shared relative test_data/ dir and rmtree'd it in teardown, racing under xdist; use a unique mkdtemp dir. Baseline 78.3% branch coverage. Refs #64, #61.
Add test_ng_utils.py (torch_impl/utils device/stability/correlation/loader, 20->65%) and test_edge_cases.py (non-2D input, single-channel/single-sample graceful handling, from_params_file, load missing-key branch). Cover plot_components activation branch. amica.py 86->96%. Total branch coverage 78.3->81.1%; ratchet the CI gate to 80. #15 save/load was already covered under #36. Refs #61, #15, #64.
3 tasks
neuromechanist
deleted the
61-test-hardening-edge-cases-+-numerical-stability-regressions
branch
July 7, 2026 21:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #61. Closes #64. Addresses #15.
Folds test hardening together with actionable code coverage, all self-contained in GitHub CI (no external service).
Coverage tooling (#64)
[tool.coverage]config: branch coverage, omit tests + the argparse CLI, exclude pragmas.pytest-xdist; CI now runspytest -m "not slow" -n auto --cov-fail-under=80and uploads the HTML report as an artifact.-n automore than pays for coverage, so on GitHub's 4-vCPU runners this should land ~3-4 min.Test isolation fix (surfaced by -n auto)
TestAMICAused a shared relativetest_data/dir andrmtreed it in teardown, racing across xdist workers (FileNotFoundError). Switched to a uniquemkdtempdir.Hardening tests
test_ng_utils.py(new):torch_impl/utils.pydevice selection, numerical-stability guards, correlation/permutation (real-data-derived), and the.fdtloader. Module 20% -> 65% (remainder is the Fortran-dir integration helper).test_edge_cases.py(new, Test hardening: edge cases + numerical-stability regressions #61): non-2D input rejection, single-channel and single-sample graceful handling (clear error or unusable-flag, never a silent NaN model),from_params_file+ override, and theloadmissing-key branch.plot_componentsactivation branch (Test coverage gaps: AMICA.save/load and plot_components #15).Coverage result
Total branch coverage 78.3% -> 81.1%;
amica.py86% -> 96%. Suite 85 -> 103 tests, 0 errors.Note on #15
The
AMICA.save/loadroundtrip #15 asked for is already covered (test_amica_ng_wrapper.py, added under #36 after #15 was filed).plot_componentsbuilds a figure but never writes a file, so #15's 'assert files are written' does not literally apply; covered its activation branch instead.