Skip to content

Related to #1175: Migrate tests/test_snippets.py to npt.assert_allclose - #1221

Merged
seanlaw merged 1 commit into
stumpy-dev:mainfrom
austinchennn:codex/migrate-test-snippets-assert-allclose
Nov 14, 2026
Merged

seanlaw merged 1 commit into
stumpy-dev:mainfrom
austinchennn:codex/migrate-test-snippets-assert-allclose

Conversation

@austinchennn

@austinchennn austinchennn commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Related to #1175

Description

Migrate all 28 npt.assert_almost_equal calls in tests/test_snippets.py to npt.assert_allclose. This file compares STUMPY's MPdist profiles and snippet outputs with naive reference implementations. Each call now passes the STUMPY cmp_ value as actual and the naive ref_ value as desired. No test cases or snippet behavior were changed.

Tolerances and limits

  • Calls that previously used decimal=config.STUMPY_TEST_PRECISION now use atol=1.5 * 10**-config.STUMPY_TEST_PRECISION (Black formatting). The current setting is 5.
  • The four regime comparisons that previously used NumPy's default decimal=7 now use atol=1.5e-07.
  • No rtol argument was added, as requested in Migrate to npt.assert_allclose #1175. In the installed NumPy 2.4.6, assert_allclose defaults to rtol=1e-07, so this is not mathematically identical to an absolute-only comparison for every possible input. The tested cases pass. I did not change config.py or the test data.
  • Validation was on macOS with Python 3.11.15; no physical CUDA/GPU validation was performed. The full repository test script has now completed successfully; details below.

Testing

Validated on macOS with Python 3.11.15, NumPy 2.4.6 and Numba 0.68.1, using the OpenMP runtime setup from the repository's macOS CI and the default RNG configuration (STUMPY_SEED unset).

  • ./setup.sh dev && ./test.sh — completed with exit status 0. Repository Black, isort, Flake8, docstring and applicable fastmath checks passed.
  • JIT phase: 2,363 passed, 32 skipped, 0 failed.
  • Coverage/simulated-CUDA phase: 2,510 passed, 17 skipped, 0 failed; repository coverage gate 100% across 15,105 statements, 0 missing.
  • Optional Ray and pyFFTW were unavailable. CUDA coverage uses the simulator; no physical CUDA device, Linux or Windows execution is claimed.
  • The changed tests/test_snippets.py passed all 147 cases in the full runs. After installing pytest-cov as requested by the checklist, a final focused run also passed 147 cases.
  • git diff --check — passed; the PR commit remains unchanged.

Pull Request Checklist

Below is a simple checklist but please do not hesitate to ask for assistance!

  • Read our Contributing Guide
  • Referenced a Github issue (or create one if one doesn't already exist)
  • Read and reviewed all of the comments in the Github issue that you've referenced (along with cross-referenced issues/pull requests) to ensure that the issue still requires a pull request
  • Checked that the issue has not already been assigned to anybody else or is already being addressed in another pull request
  • Left a meaningful comment on the original Github issue to discuss the detailed approach for your contribution and received confirmation from the maintainers before proceeding with this pull request
  • Forked, cloned, and checked out the newest version of the code
  • Created a new branch
  • Made necessary code changes
  • Installed black (i.e., python -m pip install black or conda install -c conda-forge black)
  • Installed flake8 (i.e., python -m pip install flake8 or conda install -c conda-forge flake8)
  • Installed pytest-cov (i.e., python -m pip install pytest-cov or conda install -c conda-forge pytest-cov)
  • Ran black --exclude=".*\.ipynb" --extend-exclude=".venv" --diff ./ in the root stumpy directory
  • Ran flake8 --extend-exclude=.venv ./ in the root stumpy directory
  • Ran ./setup.sh dev && ./test.sh in the root stumpy directory and ensured that all tests are passing locally
  • Check this box if AI code assistance was used to generate
    • less than 25% of the code in this pull request
    • 25-50% of the code in this pull request
    • more than 50% of the code in this pull request

Please do not commit any code to avoid/circumvent a failing test and, instead, engage in a discussion (below) to determine the best course of action.

Only request a review after the checklist above is fully completed!

@gitnotebooks

gitnotebooks Bot commented Nov 14, 2026

Copy link
Copy Markdown

Review these changes at https://app.gitnotebooks.com/stumpy-dev/stumpy/pull/1221

@austinchennn

Copy link
Copy Markdown
Contributor Author

Related to #1175. This PR migrates only tests/test_snippets.py; the full migration remains open.

@austinchennn

Copy link
Copy Markdown
Contributor Author

The Tests workflow for current head f4cff90a2fabdd28672060e36682cb43a10653fe is waiting for contributor-workflow approval: https://github.com/stumpy-dev/stumpy/actions/runs/43576827391 . Could a maintainer approve execution of this workflow?

This is a request to run CI, not a request for code review or merge before the checklist is complete. The PR explicitly records the focused/adjacent checks and that the full repository suite was not yet run. I am now running the documented ./setup.sh dev && ./test.sh locally and will report its actual outcome and platform limits. The umbrella #1175 remains open; this PR covers only tests/test_snippets.py. Thank you.

@austinchennn

Copy link
Copy Markdown
Contributor Author

The documented ./setup.sh dev && ./test.sh has now completed successfully on unchanged head f4cff90a2fabdd28672060e36682cb43a10653fe, with the repository's macOS OpenMP runtime setup and default RNG configuration:

  • JIT: 2,363 passed, 32 skipped, 0 failed.
  • Coverage/simulated CUDA: 2,510 passed, 17 skipped, 0 failed; 100% across 15,105 statements, 0 missing.
  • The changed file's 147 cases passed, including a final focused rerun; repository formatting/static checks passed.

The PR description now includes the completed project checklist and the limits: Ray/pyFFTW were unavailable, CUDA was simulated, and Linux/Windows/physical GPU execution was not performed locally. The change remains limited to this one test file; it does not close umbrella #1175.

With that local checklist complete, could you review the migration when convenient and consider merging it if the approach and upstream CI are satisfactory? Thank you.

@seanlaw
seanlaw merged commit 8c2acbe into stumpy-dev:main Nov 14, 2026
33 checks passed
@seanlaw

seanlaw commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

@austinchennn Thank you for the PR! Would you mind doing another migration?

@austinchennn

Copy link
Copy Markdown
Contributor Author

Thank you for merging this! I'd be happy to help with another migration. I'll check the current #1175 claims and confirm the next file and approach there before starting, so I don't overlap another contributor.

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.

2 participants