I have found a few usages in the wild of @require enabling test sets dynamically, but it has some surprising interactions in that a failing test within the nested @require-@testset gets printed, but does not impact Julia's return value. Example:
# test.jl
using Test, Requires
@require Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" begin
@testset "Linux-specific Tests" begin
@test false
end
end
$ julia test.jl && echo yes
Linux-specific Tests: Test Failed at /home/sabae/src/test.jl:5
Expression: false
Stacktrace:
[1] macro expansion
@ ~/src/test.jl:5 [inlined]
[2] macro expansion
@ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
[3] top-level scope
@ ~/src/test.jl:5
Test Summary: | Fail Total
Linux-specific Tests | 1 1
┌ Warning: Error requiring `Test` from `Main`
│ exception = Some tests did not pass: 0 passed, 1 failed, 0 errored, 0 broken.
└ @ Requires ~/.julia/packages/Requires/7Ncym/src/require.jl:49
yes
It looks to me like a failing test set might get caught by some generic error handling routine.
I have found a few usages in the wild of
@requireenabling test sets dynamically, but it has some surprising interactions in that a failing test within the nested@require-@testsetgets printed, but does not impact Julia's return value. Example:It looks to me like a failing test set might get caught by some generic error handling routine.