|
1 | 1 | using Test: @test
|
| 2 | +using TrixiTest: @trixi_test_nowarn |
2 | 3 | using Trixi: Trixi, examples_dir, trixi_include
|
3 | 4 | import TrixiAtmo
|
4 | 5 |
|
@@ -125,55 +126,16 @@ end
|
125 | 126 |
|
126 | 127 | # Modified version of `@test_nowarn` that prints the content of `stderr` when
|
127 | 128 | # it is not empty and ignores module replacements.
|
128 |
| -macro test_nowarn_mod(expr, additional_ignore_content = String[]) |
| 129 | +macro test_nowarn_mod(expr, additional_ignore_content = []) |
129 | 130 | quote
|
130 |
| - let fname = tempname() |
131 |
| - try |
132 |
| - ret = open(fname, "w") do f |
133 |
| - redirect_stderr(f) do |
134 |
| - $(esc(expr)) |
135 |
| - end |
136 |
| - end |
137 |
| - stderr_content = read(fname, String) |
138 |
| - if !isempty(stderr_content) |
139 |
| - println("Content of `stderr`:\n", stderr_content) |
140 |
| - end |
141 |
| - |
142 |
| - # Patterns matching the following ones will be ignored. Additional patterns |
143 |
| - # passed as arguments can also be regular expressions, so we just use the |
144 |
| - # type `Any` for `ignore_content`. |
145 |
| - ignore_content = Any[ |
146 |
| - # We need to ignore steady state information reported by our callbacks |
147 |
| - r"┌ Info: Steady state tolerance reached\n│ steady_state_callback .+\n└ t = .+\n", |
148 |
| - # We also ignore our own compilation messages |
149 |
| - "[ Info: You just called `trixi_include`. Julia may now compile the code, please be patient.\n", |
150 |
| - # TODO: Upstream (PlotUtils). This should be removed again once the |
151 |
| - # deprecated stuff is fixed upstream. |
152 |
| - "WARNING: importing deprecated binding Colors.RGB1 into Plots.\n", |
153 |
| - "WARNING: importing deprecated binding Colors.RGB4 into Plots.\n", |
154 |
| - r"┌ Warning: Keyword argument letter not supported with Plots.+\n└ @ Plots.+\n", |
155 |
| - r"┌ Warning: `parse\(::Type, ::Coloarant\)` is deprecated.+\n│.+\n│.+\n└ @ Plots.+\n", |
156 |
| - # TODO: Silence warning introduced by Flux v0.13.13. Should be properly fixed. |
157 |
| - r"┌ Warning: Layer with Float32 parameters got Float64 input.+\n│.+\n│.+\n│.+\n└ @ Flux.+\n", |
158 |
| - # NOTE: These warnings arose from Julia 1.10 onwards |
159 |
| - r"WARNING: Method definition .* in module .* at .* overwritten .*.\n", |
160 |
| - # Warnings from third party packages |
161 |
| - r"┌ Warning: Problem status ALMOST_INFEASIBLE; solution may be inaccurate.\n└ @ Convex ~/.julia/packages/Convex/.*\n", |
162 |
| - r"┌ Warning: Problem status ALMOST_OPTIMAL; solution may be inaccurate.\n└ @ Convex ~/.julia/packages/Convex/.*\n"] |
163 |
| - append!(ignore_content, $additional_ignore_content) |
164 |
| - for pattern in ignore_content |
165 |
| - stderr_content = replace(stderr_content, pattern => "") |
166 |
| - end |
167 |
| - |
168 |
| - # We also ignore simple module redefinitions for convenience. Thus, we |
169 |
| - # check whether every line of `stderr_content` is of the form of a |
170 |
| - # module replacement warning. |
171 |
| - @test occursin(r"^(WARNING: replacing module .+\.\n)*$", stderr_content) |
172 |
| - ret |
173 |
| - finally |
174 |
| - rm(fname, force = true) |
175 |
| - end |
176 |
| - end |
| 131 | + add_to_additional_ignore_content = [ |
| 132 | + # We need to ignore steady state information reported by our callbacks |
| 133 | + r"┌ Info: Steady state tolerance reached\n│ steady_state_callback .+\n└ t = .+\n", |
| 134 | + # NOTE: These warnings arose from Julia 1.10 onwards |
| 135 | + r"WARNING: Method definition .* in module .* at .* overwritten .*.\n" |
| 136 | + ] |
| 137 | + append!($additional_ignore_content, add_to_additional_ignore_content) |
| 138 | + @trixi_test_nowarn $(esc(expr)) $additional_ignore_content |
177 | 139 | end
|
178 | 140 | end
|
179 | 141 |
|
|
0 commit comments