Skip to content

Commit

Permalink
add testing with Aqua.jl (#41)
Browse files Browse the repository at this point in the history
* add testing with Aqua

* add missing compat

* skip false positive stale deps

* update readme

* activate test env when running runtests.jl manually

* remove verbose from sub testsets
  • Loading branch information
m-fila authored Aug 22, 2024
1 parent 26f6311 commit 40861ed
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
TimespanLogging = "a526e669-04d3-4846-9525-c66122c55f63"

[compat]
Aqua = "0.8"
ArgParse = "1.2"
BenchmarkTools = "1.5"
Cairo = "1.0"
Expand All @@ -47,8 +48,9 @@ TimespanLogging = "0.1.0"
julia = "1.10"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Logging", "Test"]
test = ["Aqua", "Logging", "Test"]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# FrameworkDemo.jl

[![test](https://github.com/key4hep/key4hep-julia-fwk/actions/workflows/test.yml/badge.svg)](https://github.com/key4hep/key4hep-julia-fwk/actions/workflows/test.yml)
[![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)

Demonstrator project for HEP data-processing framework in Julia

Expand Down
12 changes: 12 additions & 0 deletions test/Aqua.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Aqua
using FrameworkDemo

@testset "Aqua.jl" begin
Aqua.test_all(FrameworkDemo;
ambiguities = false,
stale_deps = (;
ignore = [:ArgParse, # bin/
:BenchmarkTools, # benchmarks.jl
:Plots, # benchmarks.jl, Dagger ext
:DataFrames]))
end
2 changes: 2 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Run the tests with:
- REPL:
```julia
append!(ARGS, <list of args>)
import TestEnv
TestEnv.activate()
include("test/runtests.jl")
```

Expand Down
2 changes: 1 addition & 1 deletion test/demo_workflows.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function run_demo(name::String, coefficients::Union{Dagger.Shard, Nothing})
end
end

@testset verbose=true "Demo workflows" begin
@testset "Demo workflows" begin
Dagger.disable_logging!()
is_fast = "no-fast" ARGS
coefficients = FrameworkDemo.calibrate_crunch(; fast = is_fast)
Expand Down
13 changes: 13 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
using Distributed
using Test

if abspath(PROGRAM_FILE) == @__FILE__
if !isnothing(Base.find_package("TestEnv"))
import TestEnv
TestEnv.activate()
else
@error "Install TestEnv package for running manually"
exit(1)
end
end

@info("Execution environment details",
julia_version=VERSION,
n_workers=Distributed.nworkers(),
Expand All @@ -9,6 +19,9 @@ using Test
test_args=repr(ARGS))

@testset verbose=true "FrameworkDemo.jl" begin
if "all" ARGS
include("Aqua.jl")
end
include("parsing.jl")
include("scheduling.jl")
include("demo_workflows.jl")
Expand Down
2 changes: 1 addition & 1 deletion test/scheduling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function get_alg_deps(logs::Dict)
return task_deps
end

@testset verbose=true "Scheduling" begin
@testset "Scheduling" begin
path = joinpath(pkgdir(FrameworkDemo), "data/demo/datadeps/df.graphml")
graph = FrameworkDemo.parse_graphml(path)
ilength(x) = sum(_ -> 1, x) # no standard length for MetaGraphs.filter_vertices iterator
Expand Down

0 comments on commit 40861ed

Please sign in to comment.