diff --git a/Project.toml b/Project.toml index 0c333df..5c9b4fe 100644 --- a/Project.toml +++ b/Project.toml @@ -15,7 +15,7 @@ ParserCombinator = "2" Pkg = "1" PythonCall = "0.9.29" SafeTestsets = "0.1, 1" -SciMLTesting = "1" +SciMLTesting = "1.6" Test = "1.10" julia = "1.10" diff --git a/test/qa/Project.toml b/test/qa/Project.toml index 2bea051..b082d60 100644 --- a/test/qa/Project.toml +++ b/test/qa/Project.toml @@ -13,5 +13,5 @@ BaseModelica = {path = "../.."} Aqua = "0.8" JET = "0.9, 0.11.2" SafeTestsets = "0.1, 1" -SciMLTesting = "1" +SciMLTesting = "1.6" julia = "1.10" diff --git a/test/qa/qa.jl b/test/qa/qa.jl index 53e7585..16fcb1d 100644 --- a/test/qa/qa.jl +++ b/test/qa/qa.jl @@ -1,11 +1,52 @@ -using BaseModelica, Aqua -@testset "Aqua" begin - Aqua.find_persistent_tasks_deps(BaseModelica) - Aqua.test_ambiguities(BaseModelica, recursive = false) - Aqua.test_deps_compat(BaseModelica) - Aqua.test_piracies(BaseModelica) - Aqua.test_project_extras(BaseModelica) - Aqua.test_stale_deps(BaseModelica) - Aqua.test_unbound_args(BaseModelica) - Aqua.test_undefined_exports(BaseModelica) -end +using SciMLTesting, BaseModelica, Test +using JET + +run_qa( + BaseModelica; + explicit_imports = true, + # MLStyle's @match expands to ambiguous-looking method tables; the original QA + # ran ambiguities non-recursively, so keep that. + # + # persistent_tasks is disabled because Aqua's probe loads the package in a + # freshly generated wrapper environment built from this Project.toml alone, and + # `using BaseModelica` there drives PythonCall's `__init__` -> CondaPkg resolve. + # That precompile takes far longer than the probe's load window, so the wrapper + # subprocess exits before signalling and Aqua reports "done.log was not created, + # but precompilation exited" — a false positive. The package defines no + # `__init__`/`@async`/`Timer`, so it leaves no persistent tasks of its own. The + # pre-run_qa qa.jl never asserted this check (it only called the non-asserting + # `find_persistent_tasks_deps`); this keeps that scope. + aqua_kwargs = (; ambiguities = (; recursive = false), persistent_tasks = false), + ei_kwargs = (; + all_qualified_accesses_via_owners = (; + # All re-exported by ModelingToolkit/Symbolics from their base libs + # (ModelingToolkitBase / SymbolicIndexingInterface / SymbolicUtils); + # owner-vs-access mismatch only. + ignore = ( + :SymbolicContinuousCallback, # owned by ModelingToolkitBase + :SymbolicDiscreteCallback, # owned by ModelingToolkitBase + :getname, # owned by SymbolicIndexingInterface + :setdefault, # owned by ModelingToolkitBase + :setguess, # owned by ModelingToolkitBase + :unwrap, # owned by SymbolicUtils + ), + ), + all_qualified_accesses_are_public = (; + # Verified on Julia 1.12 (public-API checks active) against the registered + # base-lib make-public releases (SciMLBase 3.27, DiffEqBase 7.6, + # SciMLTesting 1.7). None of these are SciMLBase-owned; each is a + # still-non-public name of a non-SciML dependency, so they stay ignored. + ignore = ( + :getname, # ModelingToolkit (re-export of SymbolicIndexingInterface, still non-public) + :None, # PythonCall.pybuiltins + :hasattr, # PythonCall.pybuiltins + :len, # PythonCall.pybuiltins + ), + ), + ), + # The module relies on many implicit imports from heavy `using` of + # ModelingToolkit/ParserCombinator/PythonCall/MLStyle/CondaPkg; making them + # explicit is a large refactor tracked in + # https://github.com/SciML/BaseModelica.jl/issues/139. + ei_broken = (:no_implicit_imports,) +) diff --git a/test/qa/test_jet.jl b/test/qa/test_jet.jl deleted file mode 100644 index da9397a..0000000 --- a/test/qa/test_jet.jl +++ /dev/null @@ -1,20 +0,0 @@ -using BaseModelica -using JET -using Test - -@testset "JET static analysis" begin - # Test that JET finds no errors in the BaseModelica module - # This helps ensure type stability and catch potential runtime errors - # Note: We use target_modules to filter reports to only BaseModelica code, - # since dependencies like SymbolicUtils use union types that trigger false positives. - @testset "Package analysis" begin - result = JET.report_package(BaseModelica; target_modules = (BaseModelica,)) - @test length(JET.get_reports(result)) == 0 - end - - # Note: @test_opt tests are not included because the codebase intentionally - # uses dynamic dispatch patterns from MLStyle.jl (@match) and ParserCombinator.jl - # which result in expected runtime dispatch. These are design choices that enable - # clean pattern matching syntax. Full type stability would require major refactoring - # that's not practical for this domain-specific language parser. -end diff --git a/test/runtests.jl b/test/runtests.jl index 66a23a3..80caa6d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -13,7 +13,6 @@ function qa_group() Pkg.develop(PackageSpec(path = dirname(@__DIR__))) Pkg.instantiate() @safetestset "Quality Assurance" include(joinpath(@__DIR__, "qa", "qa.jl")) - @safetestset "JET Static Analysis" include(joinpath(@__DIR__, "qa", "test_jet.jl")) return nothing end