Skip to content

Commit a1b2cb5

Browse files
committed
move JET tests front so that new methods do not cause failure
1 parent f1d68ff commit a1b2cb5

3 files changed

Lines changed: 37 additions & 19 deletions

File tree

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
# Unreleased
1+
## Unreleased
2+
3+
### Added
4+
### Changed
5+
### Deprecated
6+
### Removed
7+
### Fixed
8+
9+
- JET tests up front so that method extensions do not confuse it
10+
11+
### Security
12+
13+
# v3.5.1
14+
15+
**No changelog was kept after v3.3.0,** it should be reconstructed from commits.
216

317
# v3.3.0
418

test/runtests.jl

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@ using DynamicHMC.Diagnostics: ACCEPTANCE_QUANTILES
1010
using LogDensityProblems: logdensity_and_gradient, dimension, LogDensityProblems
1111
using LogDensityTestSuite
1212

13+
####
14+
#### static analysis and QA; before everything else as tests extend methods
15+
####
16+
17+
@testset "static analysis with JET.jl" begin
18+
using JET
19+
@test isempty(JET.get_reports(report_package(DynamicHMC, target_modules=(DynamicHMC,))))
20+
end
21+
22+
@testset "Aqua" begin
23+
import Aqua
24+
Aqua.test_all(DynamicHMC; ambiguities = false)
25+
# testing separately, cf https://github.com/JuliaTesting/Aqua.jl/issues/77
26+
Aqua.test_ambiguities(DynamicHMC)
27+
end
28+
1329
###
1430
### general test environment
1531
###
@@ -39,19 +55,3 @@ include("test_logging.jl")
3955
####
4056

4157
include("sample-correctness_tests.jl")
42-
43-
####
44-
#### static analysis and QA
45-
####
46-
47-
@testset "static analysis with JET.jl" begin
48-
using JET
49-
@test isempty(JET.get_reports(report_package(DynamicHMC, target_modules=(DynamicHMC,))))
50-
end
51-
52-
@testset "Aqua" begin
53-
import Aqua
54-
Aqua.test_all(DynamicHMC; ambiguities = false)
55-
# testing separately, cf https://github.com/JuliaTesting/Aqua.jl/issues/77
56-
Aqua.test_ambiguities(DynamicHMC)
57-
end

test/test_trees.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,17 @@ Base.empty!(trajectory) = empty(trajectory.visited)
4444

4545
DynamicHMC.move(::DummyTrajectory, z, is_forward) = z + (is_forward ? 1 : -1)
4646

47-
function DynamicHMC.is_turning(::DummyTrajectory, τ)
47+
const DUMMY_TURN_STATISTICS = Tuple{Bool,UnitRange{Int64}}
48+
49+
function DynamicHMC.is_turning(::DummyTrajectory, τ::DUMMY_TURN_STATISTICS)
4850
turn_flag, positions = τ
4951
@test length(positions) > 1 # not called on a leaf
5052
turn_flag
5153
end
5254

53-
function DynamicHMC.combine_turn_statistics(::DummyTrajectory, τ₁, τ₂)
55+
function DynamicHMC.combine_turn_statistics(::DummyTrajectory,
56+
τ₁::DUMMY_TURN_STATISTICS,
57+
τ₂::DUMMY_TURN_STATISTICS)
5458
turn_flag1, positions1 = τ₁
5559
turn_flag2, positions2 = τ₂
5660
@test last(positions1) + 1 == first(positions2) # adjacency and order

0 commit comments

Comments
 (0)