Canonicalize test units to @safetestset#309
Closed
ChrisRackauckas-Claude wants to merge 1 commit into
Closed
Conversation
Convert the independent top-level test units in test/runtests.jl from plain `@testset "X" begin ... end` to `@safetestset` so each runs in its own module (isolation + world-age safety), matching OrdinaryDiffEq's canonical structure. Converted units: Explicit Imports, Tests on ODEs, Multiple Shooting Objective, Likelihood Loss, Out-of-place ODE Tests, Steady State Tests, DAE Tests, DDE Tests, Test on Monte. Self-containment: - "Tests on ODEs" is a single shared-state unit: tests_on_odes/test_problems.jl defines prob1/prob2/prob3/t/data/sol consumed by the later includes in the same block, and several of those includes rely on `Optim`/etc. leaking between files in the block. It is therefore wrapped as ONE @safetestset whose body is the include chain (preserving the intra-block sharing). Added `using DiffEqParamEstim` at the top of that body since the included files relied on it leaking from Main; SafeTestsets injects `using Test`. - out_of_place_odes.jl used build_loss_objective/L2Loss but only had `using OrdinaryDiffEq, Test, ...` and relied on DiffEqParamEstim leaking from Main -> added `DiffEqParamEstim` to its `using` line. - The other standalone files already import DiffEqParamEstim and their optimizer/solver deps, so they are self-contained as @safetestset modules. Added SafeTestsets to [extras], [targets].test, and [compat] (SafeTestsets = "0.1, 1") and `using SafeTestsets` in runtests.jl. The GROUP/QA dispatch and all assertions are unchanged. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6b9ad22 to
bfe2fe6
Compare
Contributor
Author
|
Superseded by the v1.2 folder conversion on sciml-testing-rollout (#308). |
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.
Converts the independent top-level test units in
test/runtests.jlfrom plain@testset "X" begin ... endto@safetestset, so each runs in its own module (test isolation + world-age safety), matching OrdinaryDiffEq's canonical structure.Converted units:
Explicit Imports,Tests on ODEs,Multiple Shooting Objective,Likelihood Loss,Out-of-place ODE Tests,Steady State Tests,DAE Tests,DDE Tests,Test on Monte.Self-containment handling:
Tests on ODEsis a single shared-state unit:tests_on_odes/test_problems.jldefinesprob1/prob2/prob3/t/data/solthat the later includes in the same block consume, and several of those includes rely onOptim/etc. leaking between files within the block. It is therefore wrapped as one@safetestsetwhose body is the include chain (preserving the intra-block sharing exactly). Addedusing DiffEqParamEstimat the top of that body since the included files relied on it leaking fromMain; SafeTestsets injectsusing Test.out_of_place_odes.jlusedbuild_loss_objective/L2Lossbut only hadusing OrdinaryDiffEq, Test, ...and relied onDiffEqParamEstimleaking fromMain→ addedDiffEqParamEstimto itsusingline.DiffEqParamEstimplus their optimizer/solver deps, so they are self-contained as@safetestsetmodules.Deps: added
SafeTestsetsto[extras],[targets].test, and[compat](SafeTestsets = "0.1, 1"), andusing SafeTestsetsinruntests.jl.The
GROUP/QAdispatch and all assertions are unchanged.Verification: static —
Meta.parseallofruntests.jlandout_of_place_odes.jlparse cleanly, and Runic formatting passes on all changed files. The suite pulls a heavy optimization/sensitivity stack (BlackBoxOptim, NLopt, Optim, Optimization, SciMLSensitivity, Sundials, StochasticDiffEq, Zygote) with long-running global optimizers, so it was not run locally; CI will verify.This PR should be ignored until reviewed by @ChrisRackauckas.
🤖 Generated with Claude Code