Canonicalize tests to @safetestset for per-unit module isolation#178
Closed
ChrisRackauckas-Claude wants to merge 1 commit into
Closed
Canonicalize tests to @safetestset for per-unit module isolation#178ChrisRackauckas-Claude wants to merge 1 commit into
ChrisRackauckas-Claude wants to merge 1 commit into
Conversation
Convert each independent top-level test unit in the Static.jl suite from a
plain `@testset` to a `@safetestset` so it runs in its own fresh module,
matching the canonical OrdinaryDiffEq structure (test isolation + world-age
safety). Each converted unit carries its own `using` lines so its body is
self-contained.
- test/core_tests.jl: the 11 top-level `@testset` units (StaticSymbol,
StaticInt, StaticBool, operators, static interface, promote_shape, tuple
utilities, invperm, NDIndex, StaticFloat64, string/print/show) plus the
`include("ranges.jl")` and Allocation Tests units are now `@safetestset`.
Nested grouping `@testset`s inside a unit (reduce_tup, constructors, trig)
stay plain `@testset` since the unit-level `@safetestset` already isolates.
- The `maybe_static_length` block stays in a top-level `module` (its
`@inferred` helpers must be defined at module scope, not inside a testset
function, or inference degrades to `Any`).
- test/ranges.jl now carries its own `using Static, Test`.
- test/qa/qa.jl: Aqua and ExplicitImports are now separate `@safetestset`s.
- Add SafeTestsets to root Project.toml ([extras]/[targets].test/[compat])
and test/qa/Project.toml ([deps]/[compat]).
Behavior-preserving: same tests run under the same GROUP dispatch, same
assertions. Verified locally with `GROUP=Core` and `GROUP=QA` Pkg.test on
julia 1.11 — both pass.
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Superseded by the v1.2 folder conversion on sciml-testing-rollout (#177). |
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.
Summary
Converts each independent top-level test unit in the Static.jl suite from a plain
@testsetto a@safetestset, so every unit runs in its own fresh module. This matches the canonical OrdinaryDiffEq test structure and gives test isolation plus world-age safety. Each converted unit carries its ownusinglines so its body is self-contained.Changes
test/core_tests.jl: the 11 top-level@testsetunits (StaticSymbol, StaticInt, StaticBool, operators, static interface, promote_shape, tuple utilities, invperm, NDIndex, StaticFloat64, string/print/show) plus theinclude("ranges.jl")and Allocation Tests units are now@safetestset. Nested grouping@testsets inside a unit (reduce_tup,constructors,trig) stay plain@testset— the unit-level@safetestsetalready isolates them.maybe_static_lengthblock (which was bare top-level code, never in a testset) is kept in its own top-levelmodulerather than a@safetestset. Its@inferredhelpers must be defined at module scope; defining them inside a testset function degrades the inferred return type toAny(the original code deliberately kept them out of any testset for exactly this reason). Themodulewrapper still gives it per-unit isolation.test/ranges.jl: now carries its ownusing Static, Test(previously relied on leakage fromcore_tests.jl).test/qa/qa.jl:AquaandExplicitImportsare now separate@safetestsets, each with its own imports.SafeTestsetsto the rootProject.toml([extras]/[targets].test/[compat]) and totest/qa/Project.toml([deps]/[compat]).Behavior preservation
Same tests run under the same
GROUPdispatch with the same assertions — only the per-unit wrapper changed. TheGROUP-dispatch ladder andruntests.jlstructure are untouched.Verification
Verified locally on Julia 1.11:
GROUP=CorePkg.test()— passes (all units green; Allocation Tests 34/34).GROUP=QAPkg.test()— passes (Aqua 9 pass / 1 pre-existing broken, ExplicitImports 2/2).This PR is a draft. Please ignore until reviewed by @ChrisRackauckas.
🤖 Generated with Claude Code