Skip to content

Commit 5b5a226

Browse files
committed
stop throwing exception for test managers
1 parent d193994 commit 5b5a226

File tree

5 files changed

+9
-29
lines changed

5 files changed

+9
-29
lines changed

base/client.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,7 @@ end
128128
display_error(er) = display_error(er, [])
129129
function display_error(er, bt)
130130
print_with_color(Base.error_color(), STDERR, "ERROR: "; bold = true)
131-
with_output_color(Base.error_color(), STDERR) do io
132-
showerror(io, er, bt)
133-
println(io)
134-
end
131+
Base.showerror(IOContext(STDERR, :limit => true), er, bt)
135132
end
136133

137134
function eval_user_input(ast::ANY, show_value)

base/pkg/entry.jl

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -731,13 +731,6 @@ function test!(pkg::AbstractString,
731731
isfile(reqs_path) && resolve()
732732
end
733733

734-
type PkgTestError <: Exception
735-
msg::String
736-
end
737-
738-
Base.show(io::IO, pkgerr::PkgTestError) = print(io, pkgerr.msg)
739-
Base.showerror(io::IO, ex::PkgTestError, bt; backtrace=true) = Base.showerror(io, ex)
740-
741734
function test(pkgs::Vector{AbstractString}; coverage::Bool=false)
742735
errs = AbstractString[]
743736
nopkgs = AbstractString[]
@@ -758,8 +751,10 @@ function test(pkgs::Vector{AbstractString}; coverage::Bool=false)
758751
if !isempty(notests)
759752
push!(messages, "$(join(notests,", "," and ")) did not provide a test/runtests.jl file")
760753
end
761-
throw(PkgTestError(join(messages, "and")))
754+
Base.display_error(PkgError(join(messages, "and")))
755+
!Base.isinteractive() && exit(1)
762756
end
757+
return nothing
763758
end
764759

765760
test(;coverage::Bool=false) = test(sort!(AbstractString[keys(installed())...]); coverage=coverage)

base/test.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,6 @@ function Base.show(io::IO, ex::TestSetException)
382382
print(io, ex.broken, " broken.")
383383
end
384384

385-
Base.showerror(io::IO, ex::TestSetException, bt; backtrace=true) = show(io, ex)
386-
387385
#-----------------------------------------------------------------------
388386

389387
"""
@@ -523,7 +521,9 @@ function finish(ts::DefaultTestSet)
523521
if total != total_pass + total_broken
524522
# Get all the error/failures and bring them along for the ride
525523
efs = filter_errors(ts)
526-
throw(TestSetException(total_pass,total_fail,total_error, total_broken, efs))
524+
Base.display_error(TestSetException(total_pass,total_fail,total_error, total_broken, efs))
525+
println()
526+
Base.isinteractive() ? (return nothing) : exit(1)
527527
end
528528

529529
# return the testset so it is returned from the @testset macro

test/pkg.jl

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -273,15 +273,15 @@ temp_pkg_dir() do
273273
Pkg.test("IDoNotExist")
274274
error("unexpected")
275275
catch ex
276-
@test isa(ex,Pkg.Entry.PkgTestError)
276+
@test isa(ex,Pkg.PkgError)
277277
@test ex.msg == "IDoNotExist is not an installed package"
278278
end
279279

280280
try
281281
Pkg.test("IDoNotExist1", "IDoNotExist2")
282282
error("unexpected")
283283
catch ex
284-
@test isa(ex,Pkg.Entry.PkgTestError)
284+
@test isa(ex,Pkg.PkgError)
285285
@test ex.msg == "IDoNotExist1 and IDoNotExist2 are not installed packages"
286286
end
287287
end
@@ -561,9 +561,3 @@ temp_pkg_dir() do
561561
@test contains(msg, "- $package\nRestart Julia to use the updated versions.")
562562
end
563563
end
564-
565-
let
566-
io = IOBuffer()
567-
Base.showerror(io, Base.Pkg.Entry.PkgTestError("ppp"), backtrace())
568-
@test !contains(String(take!(io)), "backtrace()")
569-
end

test/test.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,3 @@ end
395395
end
396396
@test_throws ErrorException @testset "$(error())" begin
397397
end
398-
399-
let
400-
io = IOBuffer()
401-
Base.showerror(io, Test.TestSetException(1,2,3,4,Vector{Union{Base.Test.Error, Base.Test.Fail}}()), backtrace())
402-
@test !contains(String(take!(io)), "backtrace()")
403-
end

0 commit comments

Comments
 (0)