Skip to content

Commit 6978b54

Browse files
committed
Allow users to transform the test expression for files
1 parent dc61eec commit 6978b54

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/ParallelTestRunner.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,9 @@ Workers are automatically recycled when they exceed memory limits to prevent out
513513
issues during long test runs. The memory limit is set based on system architecture.
514514
"""
515515
function runtests(mod::Module, ARGS; test_filter = Returns(true), RecordType = TestRecord,
516-
custom_tests::Dict{String, Expr}=Dict{String, Expr}(), init_code = :(),
517-
test_worker = Returns(nothing), stdout = Base.stdout, stderr = Base.stderr)
516+
custom_tests::Dict{String, Expr} = Dict{String, Expr}(), test_transform = (test, expr) -> expr,
517+
init_code = :(), test_worker = Returns(nothing),
518+
stdout = Base.stdout, stderr = Base.stderr)
518519
#
519520
# set-up
520521
#
@@ -583,9 +584,10 @@ function runtests(mod::Module, ARGS; test_filter = Returns(true), RecordType = T
583584

584585
append!(tests, files)
585586
for file in files
586-
test_runners[file] = quote
587+
expr = quote
587588
include($(joinpath(WORKDIR, file * ".jl")))
588589
end
590+
test_runners[file] = test_transform(file, expr)
589591
end
590592
end
591593
## finalize
@@ -620,7 +622,6 @@ function runtests(mod::Module, ARGS; test_filter = Returns(true), RecordType = T
620622
jobs = clamp(jobs, 1, length(tests))
621623
println(stdout, "Running $jobs tests in parallel. If this is too many, specify the `--jobs=N` argument to the tests, or set the `JULIA_CPU_THREADS` environment variable.")
622624
workers = addworkers(min(jobs, length(tests)))
623-
nworkers = length(workers)
624625

625626
t0 = time()
626627
results = []

0 commit comments

Comments
 (0)