diff --git a/test/scopedvalues.jl b/test/scopedvalues.jl index 2c2f4a510c1c9..056a8b425c50d 100644 --- a/test/scopedvalues.jl +++ b/test/scopedvalues.jl @@ -82,11 +82,16 @@ end @testset "show" begin @test sprint(show, ScopedValue{Int}()) == "Base.ScopedValues.ScopedValue{$Int}(undefined)" @test sprint(show, sval) == "Base.ScopedValues.ScopedValue{$Int}(1)" - @test sprint(show, Core.current_scope()) == "nothing" + if Core.current_scope() === nothing + # Base.runtests uses @timed which introduces a scope for scheduler timing + @test sprint(show, Core.current_scope()) == "nothing" + end with(sval => 2.0) do @test sprint(show, sval) == "Base.ScopedValues.ScopedValue{$Int}(2)" objid = sprint(show, Base.objectid(sval)) - @test sprint(show, Core.current_scope()) == "Base.ScopedValues.Scope(Base.ScopedValues.ScopedValue{$Int}@$objid => 2)" + # Base.runtests uses @timed which introduces a scope for scheduler timing + @test startswith(sprint(show, Core.current_scope()), "Base.ScopedValues.Scope(") + @test contains(sprint(show, Core.current_scope()), "Base.ScopedValues.ScopedValue{$Int}@$objid => 2") end end