Skip to content

Commit

Permalink
Add and fix aqua tests
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed Sep 5, 2023
1 parent aa274c1 commit 15a62d5
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[deps]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
ArtifactWrappers = "a14bc488-3040-4b00-9dc1-f6467924858a"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
CLIMAParameters = "6eacf6c3-8458-43b9-ae03-caf5306d3d53"
Expand All @@ -20,8 +21,8 @@ Thermodynamics = "b60c26fb-14c3-4610-9d3e-2d17fe7ff00c"
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"

[compat]
CLIMAParameters = "0.6, 0.7"
ArtifactWrappers = "0.2"
CLIMAParameters = "0.6, 0.7"
KernelAbstractions = "0.7, 0.8"
RootSolvers = "0.4"
UnPack = "1.0"
Expand Down
37 changes: 37 additions & 0 deletions test/aqua.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Test
using Thermodynamics
using Aqua

@testset "Aqua tests (performance)" begin
# This tests that we don't accidentally run into
# https://github.com/JuliaLang/julia/issues/29393
ua = Aqua.detect_unbound_args_recursively(Thermodynamics)
@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(Thermodynamics; recursive = true)
pkg_match(pkgname, pkdir::Nothing) = false
pkg_match(pkgname, pkdir::AbstractString) = occursin(pkgname, pkdir)
filter!(x -> pkg_match("Thermodynamics", pkgdir(last(x).module)), ambs)

# If the number of ambiguities is less than the limit below,
# then please lower the limit based on the new number of ambiguities.
# We're trying to drive this number down to zero to reduce latency.
# 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(Thermodynamics)
Aqua.test_stale_deps(Thermodynamics)
Aqua.test_deps_compat(Thermodynamics)
Aqua.test_project_extras(Thermodynamics)
Aqua.test_project_toml_formatting(Thermodynamics)
Aqua.test_piracy(Thermodynamics)
end

nothing
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ if !haskey(ENV, "BUILDKITE")
Pkg.develop(Pkg.PackageSpec(; path = dirname(@__DIR__)))
end

include("aqua.jl")
include("TemperatureProfiles.jl")
include("relations.jl")

Expand Down

0 comments on commit 15a62d5

Please sign in to comment.