From ac6c97e74c4d6531c35df97a4f282deb63f76e81 Mon Sep 17 00:00:00 2001 From: nefrathenrici Date: Tue, 25 Jun 2024 14:18:56 -0700 Subject: [PATCH] Add julia compat, aqua tests --- Project.toml | 1 + test/Project.toml | 1 + test/aqua.jl | 31 +++++++++++++++++++++++++++++++ test/runtests.jl | 1 + 4 files changed, 34 insertions(+) create mode 100644 test/aqua.jl diff --git a/Project.toml b/Project.toml index 7f66ae69..b87717fa 100644 --- a/Project.toml +++ b/Project.toml @@ -25,3 +25,4 @@ JLD2 = "0.4" Random = "1" TOML = "1" YAML = "0.4" +julia = "1.9" diff --git a/test/Project.toml b/test/Project.toml index 77ce91b0..be47dac3 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,4 +1,5 @@ [deps] +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" CalibrateEmulateSample = "95e48a1f-0bec-4818-9538-3db4340308e3" ClimaCalibrate = "4347a170-ebd6-470c-89d3-5c705c0cacc2" ClimaParams = "5c42b081-d73a-476f-9059-fd94b934656c" diff --git a/test/aqua.jl b/test/aqua.jl new file mode 100644 index 00000000..c6cb75e1 --- /dev/null +++ b/test/aqua.jl @@ -0,0 +1,31 @@ +using Test +using ClimaCalibrate +using Aqua + +@testset "Aqua tests (performance)" begin + ua = Aqua.detect_unbound_args_recursively(ClimaCalibrate) + @test length(ua) == 0 + + # See: https://github.com/SciML/OrdinaryDiffEq.jl/issues/1750 + # Test that we're not introducing method ambiguities across deps + ambs = Aqua.detect_ambiguities(ClimaCalibrate; recursive = true) + pkg_match(pkgname, pkdir::Nothing) = false + pkg_match(pkgname, pkdir::AbstractString) = occursin(pkgname, pkdir) + filter!(x -> pkg_match("ClimaCalibrate", pkgdir(last(x).module)), ambs) + + # Uncomment for debugging: + # for method_ambiguity in ambs + # @show method_ambiguity + # end + @test length(ambs) == 0 +end + +@testset "Aqua tests (additional)" begin + Aqua.test_undefined_exports(ClimaCalibrate) + Aqua.test_stale_deps(ClimaCalibrate) + Aqua.test_deps_compat(ClimaCalibrate) + Aqua.test_project_extras(ClimaCalibrate) + Aqua.test_piracies(ClimaCalibrate) +end + +nothing diff --git a/test/runtests.jl b/test/runtests.jl index 011c8b63..abc513c5 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -4,3 +4,4 @@ include("ekp_interface.jl") include("model_interface.jl") include("emulate_sample.jl") include("pure_julia_e2e.jl") +include("aqua.jl")