From 6eeceb5f11db31b78556f5055a12e1b11319478f Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Fri, 4 Sep 2026 05:43:24 -0400 Subject: [PATCH] Make generated group includes statically analyzable Co-Authored-By: Chris Rackauckas Co-Authored-By: OpenAI Codex Agent-Harness: Codex CLI 0.151.0 Agent-Model: gpt-5.6-sol Agent-Session: local session ID 01a0598f-11b9-72d1-91d9-b2fbb186557d --- src/SciMLTesting.jl | 4 ++-- test/runtests.jl | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/SciMLTesting.jl b/src/SciMLTesting.jl index ee285f9..62c66ee 100644 --- a/src/SciMLTesting.jl +++ b/src/SciMLTesting.jl @@ -46,7 +46,7 @@ using Pkg: Pkg using PrecompileTools: @compile_workload, @setup_workload using TOML: TOML using Test: Test, @testset, @test, @test_broken -using SafeTestsets: SafeTestsets, @safetestset +using SafeTestsets: SafeTestsets using Aqua: Aqua using ExplicitImports: ExplicitImports # REPL provides the public `@doc` lookup used on Julia 1.10, before `Docs.hasdoc` @@ -1891,7 +1891,7 @@ function _run_body(body; label::AbstractString = "Group") GlobalRef(SafeTestsets, Symbol("@safetestset")), LineNumberNode(@__LINE__, @__FILE__), string(label), - Expr(:block, :(include($path))), + Expr(:block, Expr(:call, :include, path)), ) Core.eval(Main, expr) elseif _callable(body) diff --git a/test/runtests.jl b/test/runtests.jl index 190dc9c..2311fd3 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -264,6 +264,8 @@ function Test.finish(ts::ProbeTestSet) return ts end +using ExplicitImports + @testset "SciMLTesting" begin @testset "current_group" begin # Default when unset. @@ -917,6 +919,11 @@ end @test FakeExplicitImports.PUBLIC_CALLED[] == (VERSION >= v"1.11") end + @testset "SciMLTesting source analyzability" begin + @test ExplicitImports.check_no_implicit_imports(SciMLTesting) === nothing + @test ExplicitImports.check_no_stale_explicit_imports(SciMLTesting) === nothing + end + @testset "generated enum modules are excluded from source analysis" begin @test SciMLTesting._generated_enum_modules(EnumFixture) == (EnumFixture.Generated,) kwargs = SciMLTesting._explicit_imports_kwargs(