Skip to content

Stacktraces from the repl aren't shortened from within @testsets #56908

Open
@IanButterworth

Description

@IanButterworth

This looks good

julia> error()
ERROR:
Stacktrace:
 [1] error()
   @ Base ./error.jl:45
 [2] top-level scope
   @ REPL[1]:1

julia> @time error()
ERROR:
Stacktrace:
 [1] error()
   @ Base ./error.jl:45
 [2] macro expansion
   @ ./timing.jl:611 [inlined]
 [3] top-level scope
   @ ./REPL[4]:1

But I believe everything past the 4th frame here should be hidden as repl internals.

julia> using Test

julia> @testset begin
       error()
       end
test set: Error During Test at REPL[3]:1
  Got exception outside of a @test

  Stacktrace:
    [1] error()
      @ Base ./error.jl:45
    [2] top-level scope
      @ REPL[3]:2
    [3] macro expansion
      @ ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.12/Test/src/Test.jl:1724 [inlined]
    [4] macro expansion
      @ REPL[3]:2 [inlined]
    [5] __repl_entry_eval_expanded_with_loc(mod::Module, ast::Any, toplevel_file::Ref{Ptr{UInt8}}, toplevel_line::Ref{Int32})
      @ REPL ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:341
    [6] #invokelatest#1
      @ ./essentials.jl:1056 [inlined]
    [7] invokelatest
      @ ./essentials.jl:1052 [inlined]
    [8] toplevel_eval_with_hooks(mod::Module, ast::Any, toplevel_file::Any, toplevel_line::Any)
      @ REPL ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:348
    [9] toplevel_eval_with_hooks(mod::Module, ast::Any, toplevel_file::Any, toplevel_line::Any)
      @ REPL ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:352
   [10] toplevel_eval_with_hooks
      @ ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:345 [inlined]
   [11] eval_user_input(ast::Any, backend::REPL.REPLBackend, mod::Module)
      @ REPL ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:370
   [12] repl_backend_loop(backend::REPL.REPLBackend, get_module::Function)
      @ REPL ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:482
   [13] start_repl_backend(backend::REPL.REPLBackend, consumer::Any; get_module::Function)
      @ REPL ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:467
   [14] start_repl_backend
      @ ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:464 [inlined]
   [15] run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool, backend::Any)
      @ REPL ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:690
   [16] run_repl(repl::REPL.AbstractREPL, consumer::Any)
      @ REPL ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:676
   [17] run_std_repl(REPL::Module, quiet::Bool, banner::Symbol, history_file::Bool)
      @ Base ./client.jl:490
   [18] #invokelatest#1
      @ ./essentials.jl:1056 [inlined]
   [19] invokelatest
      @ ./essentials.jl:1052 [inlined]
   [20] run_main_repl(interactive::Bool, quiet::Bool, banner::Symbol, history_file::Bool)
      @ Base ./client.jl:511
   [21] repl_main
      @ ./client.jl:593 [inlined]
   [22] _start()
      @ Base ./client.jl:568
Test Summary: | Error  Total  Time
test set      |     1      1  0.5s
ERROR: Some tests did not pass: 0 passed, 0 failed, 1 errored, 0 broken.

julia>

Seems to be related to #49451

Metadata

Metadata

Assignees

No one assigned

    Labels

    REPLJulia's REPL (Read Eval Print Loop)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions