Skip to content

Commit bba044f

Browse files
authored
Activate the test env with TestEnv.jl (#115)
* add aqua badge in readme * wrap aqua in testset to hide subtests * merge test and main project files, use TestEnv to activate test env
1 parent 3d240cb commit bba044f

File tree

7 files changed

+16
-27
lines changed

7 files changed

+16
-27
lines changed

Project.toml

+5-1
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ JetVisualisation = "Makie"
2424

2525
[compat]
2626
Accessors = "0.1.36"
27+
Aqua = "0.8"
2728
CodecZlib = "0.7.4"
2829
EDM4hep = "0.4.0"
2930
EnumX = "1.0.4"
31+
JSON = "0.21"
3032
Logging = "1.9"
3133
LoopVectorization = "0.12.170"
3234
LorentzVectorHEP = "0.1.6"
@@ -38,7 +40,9 @@ Test = "1.9"
3840
julia = "1.9"
3941

4042
[extras]
43+
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
4144
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
45+
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
4246

4347
[targets]
44-
test = ["Test"]
48+
test = ["Aqua", "Test", "JSON"]

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
[![DOI](https://zenodo.org/badge/507671522.svg)](https://zenodo.org/doi/10.5281/zenodo.12671414)
88
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliahep.github.io/JetReconstruction.jl/stable)
99
[![](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliahep.github.io/JetReconstruction.jl/dev)
10+
[![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)
1011

1112
## This package implements sequential Jet Reconstruction (clustering)
1213

test/Project.toml

-12
This file was deleted.

test/README.md

+3-7
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,10 @@
22

33
This directory contains the unit tests for the JetReconstruction package.
44

5-
As there are dependencies that are only used for tests, there is a specific
6-
`Project.toml` file for testing. However, **make sure that the
7-
`JetReconstruction` package is in develop mode**.
8-
95
To run all of the tests do:
106

117
```sh
12-
julia --project=test runtests.jl
8+
julia --project test/runtests.jl
139
```
1410

1511
or
@@ -21,8 +17,8 @@ julia> ]
2117
...
2218
```
2319

24-
Tests are factorised into individual files as `test-*.jl`. By use of `common.jl` all of these tests can be run standalone, e.g.,
20+
Tests are factorised into individual files as `test-*.jl`. By use of `common.jl` all of these tests can be run standalone, provided that `TestEnv.jl` is installed in the default environment, e.g.,
2521

2622
```sh
27-
julia --project=test test-pp-reconstruction.jl
23+
julia --project test/test-pp-reconstruction.jl
2824
```

test/common.jl

+4
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@
66
# to avoid double-including the common file.
77

88
if !@isdefined JETRECO_TEST_COMMON
9+
if !isempty(PROGRAM_FILE)
10+
import TestEnv
11+
TestEnv.activate()
12+
end
913
include("_common.jl")
1014
end

test/runtests.jl

-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
#! /usr/bin/env julia
22

3-
using JetReconstruction
4-
using Test
5-
using JSON
6-
using LorentzVectorHEP
7-
using Logging
8-
93
include("common.jl")
104

115
function main()

test/test-aqua.jl

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
using Aqua
44

55
include("common.jl")
6-
Aqua.test_all(JetReconstruction)
6+
@testset "Aqua.jl" begin
7+
Aqua.test_all(JetReconstruction)
8+
end

0 commit comments

Comments
 (0)