Skip to content

Commit f5176c6

Browse files
test: avoid spamming stderr in debugging tests
1 parent 3192166 commit f5176c6

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

Project.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ DynamicQuantities = "^0.11.2, 0.12, 0.13, 1"
104104
EnumX = "1.0.4"
105105
ExprTools = "0.1.10"
106106
Expronicon = "0.8"
107+
FMI = "0.14"
107108
FindFirstFunctions = "1"
108109
ForwardDiff = "0.10.3"
109110
FunctionWrappers = "1.1"
110111
FunctionWrappersWrappers = "0.1"
111-
FMI = "0.14"
112112
Graphs = "1.5.2"
113113
HomotopyContinuation = "2.11"
114114
InfiniteOpt = "0.5"
@@ -119,6 +119,7 @@ LabelledArrays = "1.3"
119119
Latexify = "0.11, 0.12, 0.13, 0.14, 0.15, 0.16"
120120
Libdl = "1"
121121
LinearAlgebra = "1"
122+
Logging = "1"
122123
MLStyle = "0.4.17"
123124
ModelingToolkitStandardLibrary = "2.19"
124125
NaNMath = "0.3, 1"
@@ -143,8 +144,8 @@ SimpleNonlinearSolve = "0.1.0, 1, 2"
143144
SparseArrays = "1"
144145
SpecialFunctions = "0.7, 0.8, 0.9, 0.10, 1.0, 2"
145146
StaticArrays = "0.10, 0.11, 0.12, 1.0"
146-
StochasticDiffEq = "6.72.1"
147147
StochasticDelayDiffEq = "1.8.1"
148+
StochasticDiffEq = "6.72.1"
148149
SymbolicIndexingInterface = "0.3.37"
149150
SymbolicUtils = "3.14"
150151
Symbolics = "6.29"
@@ -164,6 +165,7 @@ ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
164165
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
165166
Ipopt_jll = "9cc047cb-c261-5740-88fc-0cf96f7bdcc7"
166167
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
168+
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
167169
ModelingToolkitStandardLibrary = "16a59e39-deab-5bd0-87e4-056b12336739"
168170
NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
169171
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
@@ -187,4 +189,4 @@ Sundials = "c3572dad-4567-51f8-b174-8c6c989267f4"
187189
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
188190

189191
[targets]
190-
test = ["AmplNLWriter", "BenchmarkTools", "ControlSystemsBase", "DataInterpolations", "DelayDiffEq", "NonlinearSolve", "ForwardDiff", "Ipopt", "Ipopt_jll", "ModelingToolkitStandardLibrary", "Optimization", "OptimizationOptimJL", "OptimizationMOI", "OrdinaryDiffEq", "OrdinaryDiffEqCore", "OrdinaryDiffEqDefault", "REPL", "Random", "ReferenceTests", "SafeTestsets", "StableRNGs", "Statistics", "SteadyStateDiffEq", "Test", "StochasticDiffEq", "Sundials", "StochasticDelayDiffEq", "Pkg", "JET", "OrdinaryDiffEqNonlinearSolve"]
192+
test = ["AmplNLWriter", "BenchmarkTools", "ControlSystemsBase", "DataInterpolations", "DelayDiffEq", "NonlinearSolve", "ForwardDiff", "Ipopt", "Ipopt_jll", "ModelingToolkitStandardLibrary", "Optimization", "OptimizationOptimJL", "OptimizationMOI", "OrdinaryDiffEq", "OrdinaryDiffEqCore", "OrdinaryDiffEqDefault", "REPL", "Random", "ReferenceTests", "SafeTestsets", "StableRNGs", "Statistics", "SteadyStateDiffEq", "Test", "StochasticDiffEq", "Sundials", "StochasticDelayDiffEq", "Pkg", "JET", "OrdinaryDiffEqNonlinearSolve", "Logging"]

test/debugging.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using ModelingToolkit, OrdinaryDiffEq, StochasticDiffEq, SymbolicIndexingInterface
2+
import Logging
23
using ModelingToolkit: t_nounits as t, D_nounits as D, ASSERTION_LOG_VARIABLE
34

45
@variables x(t)
@@ -25,11 +26,11 @@ end
2526
dsys = debug_system(sys; functions = [])
2627
@test is_parameter(dsys, ASSERTION_LOG_VARIABLE)
2728
prob = Problem(dsys, [x => 0.1], (0.0, 5.0))
28-
sol = solve(prob, alg)
29-
@test !SciMLBase.successful_retcode(sol)
30-
prob.ps[ASSERTION_LOG_VARIABLE] = true
3129
sol = @test_logs (:error, r"ohno") match_mode=:any solve(prob, alg)
3230
@test !SciMLBase.successful_retcode(sol)
31+
prob.ps[ASSERTION_LOG_VARIABLE] = false
32+
sol = @test_logs min_level=Logging.Error solve(prob, alg)
33+
@test !SciMLBase.successful_retcode(sol)
3334
end
3435
end
3536

@@ -41,10 +42,10 @@ end
4142
dsys = debug_system(outer; functions = [])
4243
@test is_parameter(dsys, ASSERTION_LOG_VARIABLE)
4344
prob = Problem(dsys, [inner.x => 0.1], (0.0, 5.0))
44-
sol = solve(prob, alg)
45-
@test !SciMLBase.successful_retcode(sol)
46-
prob.ps[ASSERTION_LOG_VARIABLE] = true
4745
sol = @test_logs (:error, r"ohno") match_mode=:any solve(prob, alg)
4846
@test !SciMLBase.successful_retcode(sol)
47+
prob.ps[ASSERTION_LOG_VARIABLE] = false
48+
sol = @test_logs min_level=Logging.Error solve(prob, alg)
49+
@test !SciMLBase.successful_retcode(sol)
4950
end
5051
end

0 commit comments

Comments
 (0)