Skip to content

Doesn't compose well with testsets #103

@staticfloat

Description

@staticfloat

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions