From cfa45b07a89b31e66ea9d38d924a8f8f0bc17e75 Mon Sep 17 00:00:00 2001 From: Arno Strouwen Date: Fri, 29 Dec 2023 19:46:42 +0100 Subject: [PATCH] Aqua CI --- Project.toml | 7 +++++++ src/operators/basic_operators.jl | 3 ++- src/operators/diffeq_operator.jl | 2 +- test/aqua.jl | 34 -------------------------------- test/qa.jl | 11 +++++++++++ test/runtests.jl | 30 +++++++++++----------------- 6 files changed, 33 insertions(+), 54 deletions(-) delete mode 100644 test/aqua.jl create mode 100644 test/qa.jl diff --git a/Project.toml b/Project.toml index 874d0569f..743994e06 100644 --- a/Project.toml +++ b/Project.toml @@ -50,12 +50,14 @@ SciMLBaseZygoteExt = "Zygote" [compat] ADTypes = "0.2.5" +Aqua = "0.8" ArrayInterface = "7.6" ChainRules = "1.58.0" ChainRulesCore = "1.18" CommonSolve = "0.2.4" ConstructionBase = "1.5" DataFrames = "1.6" +DelayDiffEq = "5" Distributed = "1.9" DocStringExtensions = "0.9" EnumX = "1" @@ -66,7 +68,9 @@ LinearAlgebra = "1.9" Logging = "1.9" Markdown = "1.9" ModelingToolkit = "8.74" +OrdinaryDiffEq = "6" PartialFunctions = "1.1" +Pkg = "1" PrecompileTools = "1.2" Preferences = "1.3" Printf = "1.9" @@ -77,12 +81,15 @@ RecipesBase = "1.0" RecursiveArrayTools = "3.0" Reexport = "1" RuntimeGeneratedFunctions = "0.5" +SafeTestsets = "0.1" SciMLOperators = "0.3.7" StaticArrays = "1.7" StaticArraysCore = "1.4" Statistics = "1.9" +StochasticDiffEq = "6" SymbolicIndexingInterface = "0.3" Tables = "1.11" +Test = "1" TruncatedStacktraces = "1.4" Zygote = "0.6.67" julia = "1.9" diff --git a/src/operators/basic_operators.jl b/src/operators/basic_operators.jl index 3faab1451..0708f78a7 100644 --- a/src/operators/basic_operators.jl +++ b/src/operators/basic_operators.jl @@ -186,6 +186,7 @@ end Base.adjoint(L::FactorizedDiffEqArrayOperator) = FactorizedDiffEqArrayOperator(L.F') Base.size(L::FactorizedDiffEqArrayOperator, args...) = size(L.F, args...) +Base.size(L::FactorizedDiffEqArrayOperator, i::Integer) = size(L.F, i) function LinearAlgebra.ldiv!(Y::AbstractVecOrMat, L::FactorizedDiffEqArrayOperator, B::AbstractVecOrMat) ldiv!(Y, L.F, B) @@ -202,5 +203,5 @@ has_ldiv!(::FactorizedDiffEqArrayOperator) = true # The (u,p,t) and (du,u,p,t) interface for T in [DiffEqScalar, DiffEqArrayOperator, FactorizedDiffEqArrayOperator, DiffEqIdentity] (L::T)(u, p, t) = (update_coefficients!(L, u, p, t); L * u) - (L::T)(du, u, p, t) = (update_coefficients!(L, u, p, t); mul!(du, L, u)) + (L::T)(du::AbstractArray, u::AbstractArray, p, t) = (update_coefficients!(L, u, p, t); mul!(du, L, u)) end diff --git a/src/operators/diffeq_operator.jl b/src/operators/diffeq_operator.jl index a97063b83..c4225f561 100644 --- a/src/operators/diffeq_operator.jl +++ b/src/operators/diffeq_operator.jl @@ -46,7 +46,7 @@ function (L::AffineDiffEqOperator)(u, p, t::Number) du end -function (L::AffineDiffEqOperator)(du, u, p, t::Number) +function (L::AffineDiffEqOperator)(du::AbstractArray, u::AbstractArray, p, t::Number) update_coefficients!(L, u, p, t) L.du_cache === nothing && error("Can only use inplace AffineDiffEqOperator if du_cache is given.") diff --git a/test/aqua.jl b/test/aqua.jl deleted file mode 100644 index 6dbee8706..000000000 --- a/test/aqua.jl +++ /dev/null @@ -1,34 +0,0 @@ -using Test -using SciMLBase -using Aqua - -@testset "Aqua tests (performance)" begin - # This tests that we don't accidentally run into - # https://github.com/JuliaLang/julia/issues/29393 - Aqua.test_unbound_args(SciMLBase) - - # See: https://github.com/SciML/OrdinaryDiffEq.jl/issues/1750 - # Test that we're not introducing method ambiguities across deps - ambs = Aqua.detect_ambiguities(SciMLBase; recursive = true) - pkg_match(pkgname, pkdir::Nothing) = false - pkg_match(pkgname, pkdir::AbstractString) = occursin(pkgname, pkdir) - filter!(x -> pkg_match("SciMLBase", pkgdir(last(x).module)), ambs) - - # Uncomment for debugging: - # for method_ambiguity in ambs - # @show method_ambiguity - # end - @warn "Number of method ambiguities: $(length(ambs))" - @test length(ambs) ≤ 13 -end - -@testset "Aqua tests (additional)" begin - Aqua.test_undefined_exports(SciMLBase) - Aqua.test_stale_deps(SciMLBase) - Aqua.test_deps_compat(SciMLBase, check_extras = false) - Aqua.test_project_extras(SciMLBase) - # Aqua.test_project_toml_formatting(SciMLBase) # failing - # Aqua.test_piracy(SciMLBase) # failing -end - -nothing diff --git a/test/qa.jl b/test/qa.jl new file mode 100644 index 000000000..f3f256c28 --- /dev/null +++ b/test/qa.jl @@ -0,0 +1,11 @@ +using SciMLBase, Aqua +@testset "Aqua" begin + Aqua.find_persistent_tasks_deps(SciMLBase) + Aqua.test_ambiguities(SciMLBase, recursive = false) + Aqua.test_deps_compat(SciMLBase) + Aqua.test_piracies(SciMLBase) + Aqua.test_project_extras(SciMLBase) + Aqua.test_stale_deps(SciMLBase) + Aqua.test_unbound_args(SciMLBase) + Aqua.test_undefined_exports(SciMLBase) +end diff --git a/test/runtests.jl b/test/runtests.jl index 0c58fb841..27d1b6144 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,11 +3,7 @@ using SafeTestsets using Test using SciMLBase -# https://github.com/JuliaArrays/FillArrays.jl/pull/163 -@test_broken isempty(detect_ambiguities(SciMLBase)) - const GROUP = get(ENV, "GROUP", "All") -const is_APPVEYOR = (Sys.iswindows() && haskey(ENV, "APPVEYOR")) function activate_downstream_env() Pkg.activate("downstream") @@ -23,8 +19,8 @@ end @time begin if GROUP == "Core" || GROUP == "All" - @time @safetestset "Aqua" begin - include("aqua.jl") + @time @safetestset "Quality Assurance" begin + include("qa.jl") end @time @safetestset "Display" begin include("display.jl") @@ -64,7 +60,7 @@ end end end - if !is_APPVEYOR && GROUP == "Downstream" + if GROUP == "Downstream" activate_downstream_env() @time @safetestset "Ensembles of Zero Length Solutions" begin include("downstream/ensemble_zero_length.jl") @@ -87,16 +83,14 @@ end @time @safetestset "Symbol and integer based indexing of interpolated solutions" begin include("downstream/symbol_indexing.jl") end - if VERSION >= v"1.8" - @time @safetestset "Symbol and integer based indexing of integrators" begin - include("downstream/integrator_indexing.jl") - end - @time @safetestset "Problem Indexing" begin - include("downstream/problem_interface.jl") - end - @time @safetestset "Solution Indexing" begin - include("downstream/solution_interface.jl") - end + @time @safetestset "Symbol and integer based indexing of integrators" begin + include("downstream/integrator_indexing.jl") + end + @time @safetestset "Problem Indexing" begin + include("downstream/problem_interface.jl") + end + @time @safetestset "Solution Indexing" begin + include("downstream/solution_interface.jl") end @time @safetestset "Unitful interpolations" begin include("downstream/unitful_interpolations.jl") @@ -112,7 +106,7 @@ end end end - if !is_APPVEYOR && GROUP == "Python" + if GROUP == "Python" activate_python_env() @time @safetestset "PyCall" begin include("python/pycall.jl")