Skip to content

Commit e3b7fe8

Browse files
committed
test Aqua
1 parent 91cbb95 commit e3b7fe8

File tree

6 files changed

+70
-8
lines changed

6 files changed

+70
-8
lines changed

.github/workflows/CI.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ on:
77
pull_request:
88
jobs:
99
test:
10-
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
10+
name: ${{ matrix.group }} - Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
fail-fast: false
1414
matrix:
15+
group:
16+
- Basic
17+
- JET
1518
version:
1619
- '1.6'
1720
- '1'
@@ -20,7 +23,7 @@ jobs:
2023
arch:
2124
- x64
2225
steps:
23-
- uses: actions/checkout@v2
26+
- uses: actions/checkout@v4
2427
- uses: julia-actions/setup-julia@v1
2528
with:
2629
version: ${{ matrix.version }}
@@ -37,6 +40,8 @@ jobs:
3740
${{ runner.os }}-
3841
- uses: julia-actions/julia-buildpkg@v1
3942
- uses: julia-actions/julia-runtest@v1
43+
env:
44+
GROUP: ${{ matrix.group }}
4045
- uses: julia-actions/julia-processcoverage@v1
4146
- uses: codecov/codecov-action@v1
4247
with:
@@ -45,7 +50,7 @@ jobs:
4550
name: Documentation
4651
runs-on: ubuntu-latest
4752
steps:
48-
- uses: actions/checkout@v2
53+
- uses: actions/checkout@v4
4954
- uses: julia-actions/setup-julia@v1
5055
with:
5156
version: '1'

src/univariate/continuous/logitnormal.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# TODO: think of type piracy
2+
# this is not in Distributions (which ownes LogitNormal) because of dependency on optimize
13
mean(d::LogitNormal{T}; kwargs...) where {T} = T(estimateMean(d, kwargs...))
24

35
function mode(d::LogitNormal{T}) where {T}

test/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
[deps]
2+
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
23
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
34
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
45
LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36"
56
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
67
QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
78
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
9+
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
810
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
911
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

test/runtests.jl

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,30 @@ using Test
33
using Random: Random
44
using LoggingExtras
55

6+
7+
tmpf = () -> begin
8+
push!(LOAD_PATH, expanduser("~/julia/devtools/")) # access local pack
9+
push!(LOAD_PATH, joinpath(pwd(), "test/")) # access local pack
10+
end
11+
12+
using Test, SafeTestsets
13+
const GROUP = get(ENV, "GROUP", "All") # defined in in CI.yml
14+
@show GROUP
15+
16+
# @time begin
17+
# if GROUP == "All" || GROUP == "Basic"
18+
# #@safetestset "Tests" include("test/test_plant_face_fluct.jl")
19+
# @time @safetestset "plant_face_fluct" include("test_plant_face_fluct.jl")
20+
# end
21+
# if GROUP == "All" || GROUP == "JET"
22+
# #@safetestset "Tests" include("test/test_JET.jl")
23+
# @time @safetestset "test_JET" include("test_JET.jl")
24+
# #@safetestset "Tests" include("test/test_aqua.jl")
25+
# @time @safetestset "test_Aqua" include("test_aqua.jl")
26+
# end
27+
# end
28+
29+
630
#using Aqua; Aqua.test_all(DistributionFits) # ambiguities from other packages
731
#using JET; JET.report_package(DistributionFits) #
832
#invalid possible error due to quantile may accept/return an Array (we pass a scalar)
@@ -12,11 +36,6 @@ using LoggingExtras
1236
@testset "optimize error" begin
1337
@test_throws Exception DistributionFits.optimize(x -> x * x, -1, 1)
1438
end
15-
# Optim package for interactive testing
16-
i_loadlibs = () -> begin
17-
push!(LOAD_PATH, expanduser("~/julia/scimltools/")) # access local package repo
18-
push!(LOAD_PATH, expanduser("~/julia/18_tools/scimltools/")) # access local package repo
19-
end
2039
using Optim: Optim, optimize
2140

2241
DistributionFitsOptimExt = isdefined(Base, :get_extension) ?

test/test_JET.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using DistributionFits
2+
using Test
3+
using JET: JET
4+
5+
@testset "JET" begin
6+
@static if VERSION v"1.9.2"
7+
JET.test_package(DistributionFits; target_modules = (@__MODULE__,))
8+
end
9+
end;
10+
# JET.report_package(DistributionFits) # to debug the errors
11+
# JET.report_package(DistributionFits; target_modules=(@__MODULE__,)) # to debug the errors

test/test_aqua.jl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using DistributionFits
2+
using Test
3+
using Aqua
4+
5+
@testset "DistributionFits.jl" begin
6+
@testset "Code quality (Aqua.jl)" begin
7+
Aqua.test_all(
8+
DistributionFits;
9+
#unbound_args = false, # does not recognize NamedTuple{K, NTuple{N,E}}
10+
stale_deps = (ignore = [:Requires],),
11+
#ambiguities = false, # many ambiguities in Symbolic and Stats packages
12+
piracies = false
13+
)
14+
end;
15+
@testset "ambiguities package" begin
16+
Aqua.test_ambiguities(DistributionFits;)
17+
end;
18+
@testset "pircacy" begin
19+
Aqua.test_piracies(DistributionFits;
20+
treat_as_own = [LogitNormal] # TODO
21+
)
22+
end;
23+
end

0 commit comments

Comments
 (0)