Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ParallelTestRunner"
uuid = "d3525ed8-44d0-4b2c-a655-542cee43accc"
authors = ["Valentin Churavy <v.churavy@gmail.com>"]
version = "2.3.0"
version = "2.4.0"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
12 changes: 9 additions & 3 deletions src/ParallelTestRunner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,13 @@ function runtests(mod::Module, args::ParsedArgs;
# print the output generated by each testset
for (testname, result, output, start, stop) in results
if !isempty(output)
println(io_ctx.stdout, "\nOutput generated during execution of '$testname':")
print(io_ctx.stdout, "\nOutput generated during execution of '")
if result isa Exception || anynonpass(result.value)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this could be limited to result isa Exception? Test failures should already be displayed somewhere else, but it's the output of crashed jobs which is more important to quickly find.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So with

Suggested change
if result isa Exception || anynonpass(result.value)
if result isa Exception

we'd have

Image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I like it the way it currently is (failures also red)

printstyled(io_ctx.stdout, testname; color=:red)
else
printstyled(io_ctx.stdout, testname; color=:normal)
end
println(io_ctx.stdout, "':")
lines = collect(eachline(IOBuffer(output)))

for (i,line) in enumerate(lines)
Expand Down Expand Up @@ -1223,9 +1229,9 @@ function runtests(mod::Module, args::ParsedArgs;
print(io_ctx.stdout, c.output)
end
if !anynonpass(o_ts)
println(io_ctx.stdout, " \033[32;1mSUCCESS\033[0m")
printstyled(io_ctx.stdout, " SUCCESS\n"; bold=true, color=:green)
else
println(io_ctx.stderr, " \033[31;1mFAILURE\033[0m\n")
printstyled(io_ctx.stderr, " FAILURE\n\n"; bold=true, color=:red)
if VERSION >= v"1.13.0-DEV.1033"
Test.print_test_errors(io_ctx.stdout, o_ts)
else
Expand Down
13 changes: 9 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -183,20 +183,23 @@ end
@testset "failing test" begin
testsuite = Dict(
"failing test" => quote
println("This test will fail")
@test 1 == 2
end
)
error_line = @__LINE__() - 3

io = IOBuffer()
ioc = IOContext(io, :color => true)
@test_throws Test.FallbackTestSetException("Test run finished with errors") begin
runtests(ParallelTestRunner, ["--verbose"]; testsuite, stdout=io, stderr=io)
runtests(ParallelTestRunner, ["--verbose"]; testsuite, stdout=ioc, stderr=ioc)
end

str = String(take!(io))
@test contains(str, r"failing test .+ failed at")
@test contains(str, r"failing test.+ failed at")
@test contains(str, "$(basename(@__FILE__)):$error_line")
@test contains(str, "FAILURE")
@test contains(str, "Output generated during execution of '\e[31mfailing test\e[39m':")
@test contains(str, "Test Failed")
@test contains(str, "1 == 2")
end
Expand Down Expand Up @@ -263,11 +266,13 @@ end
)

io = IOBuffer()
ioc = IOContext(io, :color => true)
@test_throws Test.FallbackTestSetException("Test run finished with errors") begin
runtests(ParallelTestRunner, ["--verbose"]; testsuite, stdout=io, stderr=io)
runtests(ParallelTestRunner, ["--verbose"]; testsuite, stdout=ioc, stderr=ioc)
end

str = String(take!(io))
@test contains(str, "Output generated during execution of '\e[31mabort\e[39m':")
# Make sure we can capture the output generated by the crashed process, see
# issue <https://github.com/JuliaTesting/ParallelTestRunner.jl/issues/83>.
@test contains(str, msg)
Expand All @@ -276,7 +281,7 @@ end
@test contains(str, "in expression starting at")
# Following are messages printed by ParallelTestRunner.
@test contains(str, r"abort .+ started at")
@test contains(str, r"abort .+ crashed at")
@test contains(str, r"abort.+ crashed at")
@test contains(str, "FAILURE")
@test contains(str, "Error During Test")
@test contains(str, "Malt.TerminatedWorkerException")
Expand Down