Skip to content

Canonicalize tests to @safetestset for module isolation#55

Closed
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:mainfrom
ChrisRackauckas-Claude:canonicalize-safetestset
Closed

Canonicalize tests to @safetestset for module isolation#55
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:mainfrom
ChrisRackauckas-Claude:canonicalize-safetestset

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Contributor

What

Converts the independent top-level test units in test/runtests.jl from plain @testset blocks into @safetestset blocks, so each runs in its own freshly-generated module. This matches the canonical OrdinaryDiffEq test structure and gives per-unit isolation plus world-age safety.

Changes

  • The five units (Fast log2, Fast pow, Fast pow - Enzyme forward rule, Fast pow - Enzyme reverse rule, Fast pow - Other AD Engines) become @safetestset blocks.
  • Each unit is now self-contained: the using/import lines its body relies on are copied into the block (previously these were shared module-level imports at the top of runtests.jl).
  • The file-scope helper mooncake_derivative moves inside the one unit that uses it (Fast pow - Other AD Engines), since each @safetestset is its own module.
  • Inner @testset for ... loops (Enzyme forward/reverse rules) stay as plain @testset — the unit-level @safetestset already isolates them.
  • Adds SafeTestsets to the test deps ([compat], [extras], [targets].test).

No test logic, assertions, or test counts were changed; the GROUP/run structure is untouched (there is no GROUP ladder here).

Verification

Verified locally with julia +1.11, Pkg.test() — all units pass with identical counts:

Fast log2                      | 1200  1200
Fast pow                       |    5     5
Fast pow - Enzyme forward rule |   52    52
Fast pow - Enzyme reverse rule |   36    36
Fast pow - Other AD Engines    |    4     4
     Testing FastPower tests passed

Ignore until reviewed by @ChrisRackauckas.

Convert the five independent top-level @testset units in test/runtests.jl
into @safetestset blocks so each runs in its own module, matching the
canonical OrdinaryDiffEq structure (test isolation + world-age safety).

Each unit now carries the using/import lines its body needs; the
file-scope mooncake_derivative helper moves inside the unit that uses it.
Test logic, assertions, and counts are unchanged.

Add SafeTestsets to the test deps (compat, extras, targets.test).

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Contributor Author

Superseded by the v1.2 folder conversion on sciml-testing-rollout (#54).

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