-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathruntests.jl
98 lines (84 loc) · 3.21 KB
/
runtests.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using DynamicPPL
using AbstractMCMC
using AbstractPPL
using Bijectors
using Distributions
using DistributionsAD
using Documenter
using ForwardDiff
using MacroTools
using MCMCChains
using Tracker
using Zygote
using Setfield
using Distributed
using LinearAlgebra
using Pkg
using Random
using Serialization
using Test
using DynamicPPL: getargs_dottilde, getargs_tilde, Selector
const DIRECTORY_DynamicPPL = dirname(dirname(pathof(DynamicPPL)))
const DIRECTORY_Turing_tests = joinpath(DIRECTORY_DynamicPPL, "test", "turing")
const GROUP = get(ENV, "GROUP", "All")
Random.seed!(100)
include("test_util.jl")
@testset "DynamicPPL.jl" begin
if GROUP == "All" || GROUP == "DynamicPPL"
@testset "interface" begin
include("utils.jl")
include("compiler.jl")
include("varinfo.jl")
include("simple_varinfo.jl")
include("model.jl")
include("sampler.jl")
include("prob_macro.jl")
include("independence.jl")
include("distribution_wrappers.jl")
include("contexts.jl")
include("context_implementations.jl")
include("threadsafe.jl")
include("serialization.jl")
include("loglikelihoods.jl")
end
@testset "compat" begin
include(joinpath("compat", "ad.jl"))
end
@testset "doctests" begin
DocMeta.setdocmeta!(
DynamicPPL, :DocTestSetup, :(using DynamicPPL); recursive=true
)
doctestfilters = [
# Older versions will show "0 element Array" instead of "Type[]".
r"(Any\[\]|0-element Array{.+,[0-9]+})",
# Older versions will show "Array{...,1}" instead of "Vector{...}".
r"(Array{.+,\s?1}|Vector{.+})",
# Older versions will show "Array{...,2}" instead of "Matrix{...}".
r"(Array{.+,\s?2}|Matrix{.+})",
]
doctest(DynamicPPL; manual=false, doctestfilters=doctestfilters)
end
end
if GROUP == "All" || GROUP == "Downstream"
@testset "turing" begin
try
# activate separate test environment
Pkg.activate(DIRECTORY_Turing_tests)
Pkg.develop(PackageSpec(; path=DIRECTORY_DynamicPPL))
Pkg.instantiate()
# make sure that the new environment is considered `using` and `import` statements
# (not added automatically on Julia 1.3, see e.g. PR #209)
if !(joinpath(DIRECTORY_Turing_tests, "Project.toml") in Base.load_path())
pushfirst!(LOAD_PATH, DIRECTORY_Turing_tests)
end
include(joinpath("turing", "runtests.jl"))
catch err
err isa Pkg.Resolve.ResolverError || rethrow()
# If we can't resolve that means this is incompatible by SemVer and this is fine
# It means we marked this as a breaking change, so we don't need to worry about
# Mistakenly introducing a breaking change, as we have intentionally made one
@info "Not compatible with this release. No problem." exception = err
end
end
end
end