Skip to content

Stacktraces are hidden #261

Open
Open
@mcabbott

Description

@mcabbott

When tests fail, I think this package is somehow helpfully capturing the error (with try) and hiding it:

test_rrule: partialsort on Vector{Float64},UnitRange{Int64}: Error During Test at /home/runner/.julia/packages/ChainRulesTestUtils/YbVdW/src/testers.jl:193
[232](https://github.com/JuliaDiff/ChainRulesCore.jl/runs/8017765323?check_suite_focus=true#step:6:233)
  Got exception outside of a @test
[233](https://github.com/JuliaDiff/ChainRulesCore.jl/runs/8017765323?check_suite_focus=true#step:6:234)

Can this be removed?

The default behaviour is to print the stacktrace, which is useful information about what's actually caused the error, and where it was called from. (Not testers.jl:193.)

julia> @testset "outer" begin
         @testset "inner" begin
           @test 1+1==2
           sqrt(-1) # outside test
         end
       end
inner: Error During Test at REPL[5]:2
  Got exception outside of a @test
  DomainError with -1.0:
  sqrt will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
  Stacktrace:
    [1] throw_complex_domainerror(f::Symbol, x::Float64)
      @ Base.Math ./math.jl:33
    [2] sqrt
      @ ./math.jl:675 [inlined]
    [3] sqrt(x::Int64)
      @ Base.Math ./math.jl:1480
...
Test Summary: | Pass  Error  Total  Time
outer         |    1      1      2  0.2s
  inner       |    1      1      2  0.2s
ERROR: Some tests did not pass: 1 passed, 0 failed, 1 errored, 0 broken.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions