Canonicalize tests to @safetestset for per-unit module isolation#155
Closed
ChrisRackauckas-Claude wants to merge 1 commit into
Closed
Canonicalize tests to @safetestset for per-unit module isolation#155ChrisRackauckas-Claude wants to merge 1 commit into
ChrisRackauckas-Claude wants to merge 1 commit into
Conversation
Convert the independent top-level test units in test/runtests.jl from
plain `@testset` to `@safetestset`, so each unit runs in its own freshly
generated module (matching the canonical OrdinaryDiffEq structure for
isolation between tests and world-age safety).
Each unit body is extracted into its own self-contained file and invoked
as `@safetestset "X" begin include("x.jl") end`:
- explicit_imports.jl (Explicit Imports; already self-contained upstream)
- examples_tests.jl (Examples: set_log_level + parametrized example loop)
- creation_tests.jl (Creation: includes test_create/test_pycreate/test_jfem)
- assign_tests.jl (assign)
- interface_tests.jl (Interface)
Each new extracted file carries its own `using FEniCS` / `using Test`.
The include() form (rather than an inline @safetestset body) is used so
imports run before any FEniCS symbols are resolved, and include paths
resolve relative to test/ as before. The parametrized example loop and
other inner testsets stay plain @testset since the unit-level
@safetestset already isolates them.
Add SafeTestsets to test deps ([extras] + [targets].test, compat "0.1, 1").
Same units run in the same order with the same assertions; only the
isolation mechanism changed. FEniCS requires the FEniCS Python stack
(CI container cmhyett/julia-fenics), so this is verified statically
(Meta.parseall clean on all test files; each @safetestset has its
imports); CI will run the suite.
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 SciMLTesting v1.2 PR #154 (grouped-tests + run_tests + @safetestset). Closing this canonicalize-only PR. |
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.
What
Converts the independent top-level test units in
test/runtests.jlfrom plain@testsetto@safetestset, so each unit runs in its own freshly generated module. This matches the canonical OrdinaryDiffEq test structure (isolation between tests + world-age safety).How
Each unit body is extracted into its own self-contained file and invoked as
@safetestset "X" begin include("x.jl") end:explicit_imports.jl(already self-contained upstream)examples_tests.jl(set_log_level+ parametrized example loop)creation_tests.jl(includestest_create/test_pycreate/test_jfem)assign_tests.jlinterface_tests.jlusing FEniCS/using Test.include()form (not an inline@safetestsetbody) is used so imports run before any FEniCS symbols are resolved, and include paths resolve relative totest/as before.@testsets stay plain@testset— the unit-level@safetestsetalready isolates them.SafeTestsetsadded to test deps ([extras]+[targets].test,[compat]SafeTestsets = "0.1, 1").Same units run in the same order with the same assertions; only the isolation mechanism changed.
Verification
FEniCS requires the FEniCS Python stack (CI runs in the
cmhyett/julia-fenicscontainer), which isn't available for a local run here. Verified statically:Meta.parseallis clean on all test files, each@safetestsetcarries its needed imports, the@safetestset "X" begin include(...) endshape was smoke-tested against SafeTestsets, and the files pass Runic--check. CI will run the actual suite.Ignore until reviewed by @ChrisRackauckas.
🤖 Generated with Claude Code