Skip to content

Commit

Permalink
Suppress unneeded output in test logs
Browse files Browse the repository at this point in the history
  • Loading branch information
penelopeysm committed Dec 12, 2024
1 parent 39e4a04 commit 2003cfa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 8 additions & 1 deletion test/debug_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,14 @@
@test retype <: Tuple

# Just make sure the following is runnable.
@test (DynamicPPL.DebugUtils.model_warntype(model); true)
# Suppress output to avoid GHA slowdown(?)
@test begin
oldstd = stdout
redirect_stdout(devnull)
DynamicPPL.DebugUtils.model_warntype(model)
redirect_stdout(oldstd)
true
end
end
end
end
8 changes: 4 additions & 4 deletions test/lkj.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ _lkj_atol = 0.05
model = lkj_prior_demo()
# `SampleFromPrior` will sample in constrained space.
@testset "SampleFromPrior" begin
samples = sample(model, SampleFromPrior(), 1_000)
samples = sample(model, SampleFromPrior(), 1_000; progress=false)
@test mean(map(Base.Fix2(getindex, Colon()), samples)) target_mean atol =
_lkj_atol
end

# `SampleFromUniform` will sample in unconstrained space.
@testset "SampleFromUniform" begin
samples = sample(model, SampleFromUniform(), 1_000)
samples = sample(model, SampleFromUniform(), 1_000; progress=false)
@test mean(map(Base.Fix2(getindex, Colon()), samples)) target_mean atol =
_lkj_atol
end
Expand All @@ -39,7 +39,7 @@ end
model = lkj_chol_prior_demo(uplo)
# `SampleFromPrior` will sample in unconstrained space.
@testset "SampleFromPrior" begin
samples = sample(model, SampleFromPrior(), 1_000)
samples = sample(model, SampleFromPrior(), 1_000; progress=false)
# Build correlation matrix from factor
corr_matrices = map(samples) do s
M = reshape(s.metadata.vals, (2, 2))
Expand All @@ -50,7 +50,7 @@ end

# `SampleFromUniform` will sample in unconstrained space.
@testset "SampleFromUniform" begin
samples = sample(model, SampleFromUniform(), 1_000)
samples = sample(model, SampleFromUniform(), 1_000; progress=false)
# Build correlation matrix from factor
corr_matrices = map(samples) do s
M = reshape(s.metadata.vals, (2, 2))
Expand Down

0 comments on commit 2003cfa

Please sign in to comment.