diff --git a/src/Integrals.jl b/src/Integrals.jl index 9273c43b..107b0563 100644 --- a/src/Integrals.jl +++ b/src/Integrals.jl @@ -11,9 +11,9 @@ using SciMLBase: init, solve! using LinearAlgebra: LinearAlgebra, /, norm using Random: Random using ArrayInterface: ArrayInterface -using SciMLLogging: SciMLLogging, @SciMLMessage, MessageLevel, Silent, DebugLevel, - InfoLevel, WarnLevel, ErrorLevel, @verbosity_specifier, AbstractVerbositySpecifier, - None, Minimal, Standard, Detailed, All +using SciMLLogging: SciMLLogging, @SciMLMessage, MessageLevel, Silent, + InfoLevel, WarnLevel, @verbosity_specifier, AbstractVerbositySpecifier, + AbstractVerbosityPreset, None, Minimal, Standard, Detailed, All include("verbosity.jl") include("algorithms_meta.jl") diff --git a/test/qa/Project.toml b/test/qa/Project.toml index 42e6aea2..c4db8a0d 100644 --- a/test/qa/Project.toml +++ b/test/qa/Project.toml @@ -1,6 +1,5 @@ [deps] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" -ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7" Integrals = "de52edbc-65ea-441a-8357-d3a637375a31" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" @@ -12,10 +11,9 @@ Integrals = {path = "../.."} [compat] Aqua = "0.8" -ExplicitImports = "1.14.0" Integrals = "5" JET = "0.9, 0.10, 0.11.3" SafeTestsets = "0.1, 1" -SciMLTesting = "1" +SciMLTesting = "1.7" Test = "1.10" julia = "1.10" diff --git a/test/qa/qa.jl b/test/qa/qa.jl index 24badda3..a7aa633c 100644 --- a/test/qa/qa.jl +++ b/test/qa/qa.jl @@ -1,37 +1,34 @@ -using Integrals -using Aqua -using ExplicitImports +using SciMLTesting, Integrals, Test using JET -using Test -using LinearAlgebra: norm -@testset "Aqua" begin - Aqua.find_persistent_tasks_deps(Integrals) - Aqua.test_ambiguities(Integrals, recursive = false) - Aqua.test_deps_compat(Integrals) - Aqua.test_piracies( - Integrals, - treat_as_own = [IntegralProblem, SampledIntegralProblem] - ) - Aqua.test_project_extras(Integrals) - Aqua.test_stale_deps(Integrals) - Aqua.test_unbound_args(Integrals) - Aqua.test_undefined_exports(Integrals) -end - -@testset "ExplicitImports" begin - @test check_no_implicit_imports(Integrals) === nothing - # Note: norm is used in default parameters in included files (algorithms.jl) - # which ExplicitImports may not detect properly, so we ignore it - @test check_no_stale_explicit_imports( - Integrals; ignore = ( - :norm, :AbstractVerbositySpecifier, :MessageLevel, - :DebugLevel, :Detailed, :ErrorLevel, :Minimal, :None, :Standard, :All, - ) - ) === nothing -end +run_qa( + Integrals; + explicit_imports = true, + aqua_kwargs = (; + # IntegralProblem / SampledIntegralProblem are SciMLBase types this package + # owns the integral-solver methods for, so dispatching on them is not piracy. + piracies = (; treat_as_own = [IntegralProblem, SampledIntegralProblem]), + ), + ei_kwargs = (; + no_stale_explicit_imports = (; + # Referenced only inside `@verbosity_specifier IntegralVerbosity` (src/verbosity.jl): + # the macro generates `IntegralVerbosity(::None)` / `(::Minimal)` / ... preset + # constructors and `MessageLevel` / `AbstractVerbositySpecifier` / + # `AbstractVerbosityPreset` type guards that need these bare names in `Integrals`'s + # scope. ExplicitImports cannot see through the macro, so it reports them stale; + # dropping the imports breaks the constructor at runtime + # (`IntegralVerbosity(; preset=Standard())` -> UndefVarError: `AbstractVerbosityPreset`). + ignore = ( + :AbstractVerbositySpecifier, :AbstractVerbosityPreset, :MessageLevel, + :None, :Minimal, :Standard, :Detailed, :All, + ), + ), + ), +) -@testset "JET static analysis" begin +# Type-stability (JET opt-mode) regression guards for the hot solver paths. These are +# repo-specific @report_opt checks, orthogonal to run_qa's package-level JET typo check. +@testset "JET opt-mode solver paths" begin @testset "QuadGKJL" begin f = (x, p) -> x^2 prob = IntegralProblem(f, (0.0, 1.0)) @@ -73,11 +70,10 @@ end # VEGAS has some inherent type instability issues due to: # 1. Captured variables in closures (necessary for in-place operations) # 2. Runtime dispatch for integrand type checking - # We verify the number of issues is bounded and doesn't regress + # We verify the number of issues is bounded and doesn't regress. f = (x, p) -> x^2 prob = IntegralProblem(f, (0.0, 1.0)) rep = @report_opt target_modules = (Integrals,) solve(prob, VEGAS()) - # Allow up to 2 reports (captured variable + runtime dispatch for type check) @test length(JET.get_reports(rep)) <= 2 end end