From e290463cb487beb9bb8495977fe5ad3796e17700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Sun, 9 Nov 2025 00:14:41 +0000 Subject: [PATCH 1/4] Save stdout/err of tests with colors --- src/ParallelTestRunner.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ParallelTestRunner.jl b/src/ParallelTestRunner.jl index 1463eee..af9474c 100644 --- a/src/ParallelTestRunner.jl +++ b/src/ParallelTestRunner.jl @@ -258,7 +258,7 @@ function runtest(f, name, init_code, color) take!(pipe_initialized) read(pipe, String) end - stats = redirect_stdio(stdout=pipe, stderr=pipe) do + stats = redirect_stdio(; stdout=IOContext(pipe, :color=>$(color)), stderr=IOContext(pipe, :color=>$(color))) do put!(pipe_initialized, nothing) # @testset CustomTestRecord switches the all lower-level testset to our custom testset, From 3e63f6abc1eaf03686be222b47b1a1da9ceedd87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Sun, 9 Nov 2025 00:54:00 +0000 Subject: [PATCH 2/4] Add test for colorful output --- test/runtests.jl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index 4bf7e53..1188e00 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -230,4 +230,32 @@ end @test contains(str, "SUCCESS") end +# Issue . +@testset "colorful output" begin + testsuite = Dict( + "color" => quote + printstyled("Roses Are Red"; color=:red) + end + ) + io = IOBuffer() + ioc = IOContext(io, :color => true) + runtests(ParallelTestRunner, String[]; testsuite, stdout=ioc, stderr=ioc) + str = String(take!(io)) + @test contains(str, "\e[31mRoses Are Red\e[39m\n") + @test contains(str, "SUCCESS") + + testsuite = Dict( + "no color" => quote + print("Violets are ") + printstyled("blue"; color=:blue) + end + ) + io = IOBuffer() + ioc = IOContext(io, :color => false) + runtests(ParallelTestRunner, String[]; testsuite, stdout=ioc, stderr=ioc) + str = String(take!(io)) + @test contains(str, "Violets are blue\n") + @test contains(str, "SUCCESS") +end + end From eb28b38d5b7c65f3af0a271e4a6771bbf53f5538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Sun, 9 Nov 2025 01:25:58 +0000 Subject: [PATCH 3/4] Bump patch version number --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index ab983b7..8bdfe5e 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ParallelTestRunner" uuid = "d3525ed8-44d0-4b2c-a655-542cee43accc" authors = ["Valentin Churavy "] -version = "2.0.1" +version = "2.0.2" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" From 3aad0738cc944a51835d117fd61b1d0109cd0d1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= <765740+giordano@users.noreply.github.com> Date: Mon, 10 Nov 2025 13:35:41 +0000 Subject: [PATCH 4/4] Update src/ParallelTestRunner.jl Co-authored-by: Tim Besard --- src/ParallelTestRunner.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ParallelTestRunner.jl b/src/ParallelTestRunner.jl index af9474c..37b65cd 100644 --- a/src/ParallelTestRunner.jl +++ b/src/ParallelTestRunner.jl @@ -258,7 +258,8 @@ function runtest(f, name, init_code, color) take!(pipe_initialized) read(pipe, String) end - stats = redirect_stdio(; stdout=IOContext(pipe, :color=>$(color)), stderr=IOContext(pipe, :color=>$(color))) do + io = IOContext(pipe, :color=>$(color)) + stats = redirect_stdio(; stdout=io, stderr=io) do put!(pipe_initialized, nothing) # @testset CustomTestRecord switches the all lower-level testset to our custom testset,