@@ -256,7 +256,7 @@ function Test.finish(ts::WorkerTestSet)
256256 return ts. wrapped_ts
257257end
258258
259- function runtest(f, name, init_code, color )
259+ function runtest(f, name, init_code)
260260 function inner()
261261 # generate a temporary module to execute the tests in
262262 mod = @eval(Main, module $ (gensym(name)) end )
@@ -442,7 +442,8 @@ To add multiple workers, use [`addworkers`](@ref).
442442"""
443443function addworker(;
444444 env = Vector{Pair{String, String}}(),
445- exename = nothing , exeflags = nothing
445+ exename = nothing , exeflags = nothing ,
446+ color:: Bool = false ,
446447 )
447448 exe = test_exe()
448449 if exename === nothing
@@ -458,7 +459,7 @@ function addworker(;
458459 # Malt already sets OPENBLAS_NUM_THREADS to 1
459460 push!(env, " OPENBLAS_NUM_THREADS" => " 1" )
460461
461- io = IOBuffer()
462+ io = IOContext( IOBuffer(), :color => color )
462463 wrkr = Malt. Worker(; exename, exeflags, env, stdio_loop, stdout = io, stderr = io)
463464 WORKER_IDS[wrkr. proc_pid] = length(WORKER_IDS) + 1
464465 return wrkr
@@ -978,15 +979,15 @@ function runtests(mod::Module, args::ParsedArgs;
978979 wrkr = p
979980 end
980981 if wrkr === nothing || ! Malt. isrunning(wrkr)
981- wrkr = p = addworker()
982+ wrkr = p = addworker(; io_ctx . color )
982983 end
983984
984985 # run the test
985986 put!(printer_channel, (:started, test, worker_id(wrkr)))
986987 result = try
987988 Malt. remote_eval_wait(Main, wrkr, :(import ParallelTestRunner))
988989 Malt. remote_call_fetch(invokelatest, wrkr, runtest,
989- testsuite[test], test, init_code, io_ctx . color )
990+ testsuite[test], test, init_code)
990991 catch ex
991992 if isa(ex, InterruptException)
992993 # the worker got interrupted, signal other tasks to stop
@@ -997,7 +998,7 @@ function runtests(mod::Module, args::ParsedArgs;
997998 ex
998999 end
9991000 test_t1 = time()
1000- output = String(take!(wrkr. collected_stdout))
1001+ output = String(take!(wrkr. collected_stdout. io ))
10011002 push!(results, (test, result, output, test_t0, test_t1))
10021003
10031004 # act on the results
0 commit comments