Skip to content

Commit 90ad3b3

Browse files
committed
test: doctests in @testitem
1 parent 025b5a1 commit 90ad3b3

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

test/5_test_doctest.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@testitem "DocTest" begin
2+
using Documenter
3+
old_debug_level = get(ENV, "JULIA_DEBUG", "")
4+
DocMeta.setdocmeta!(
5+
ModelPredictiveControl,
6+
:DocTestSetup,
7+
:(
8+
using ModelPredictiveControl, ControlSystemsBase;
9+
ENV["JULIA_DEBUG"] = ""; # temporarily disable @debug logging for the doctests
10+
);
11+
recursive=true,
12+
warn=false
13+
)
14+
doctest(ModelPredictiveControl, testset="DocTest")
15+
ENV["JULIA_DEBUG"] = old_debug_level
16+
end

test/runtests.jl

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
# spell-checker: disable
2-
31
using ModelPredictiveControl
4-
using Documenter
5-
using Test, TestItemRunner
2+
using Test, TestItems, TestItemRunner
63

74
@run_package_tests(verbose=true)
85

@@ -11,19 +8,6 @@ include("1_test_sim_model.jl")
118
include("2_test_state_estim.jl")
129
include("3_test_predictive_control.jl")
1310
include("4_test_plot_sim.jl")
14-
15-
old_debug_level = get(ENV, "JULIA_DEBUG", "")
16-
DocMeta.setdocmeta!(
17-
ModelPredictiveControl,
18-
:DocTestSetup,
19-
:(
20-
using ModelPredictiveControl, ControlSystemsBase;
21-
ENV["JULIA_DEBUG"] = ""; # temporarily disable @debug logging for the doctests
22-
);
23-
recursive=true,
24-
warn=false
25-
)
26-
doctest(ModelPredictiveControl, testset="DocTest")
27-
ENV["JULIA_DEBUG"] = old_debug_level
11+
include("5_test_doctest.jl")
2812

2913
nothing

0 commit comments

Comments
 (0)