Skip to content

Commit 08f556a

Browse files
committed
Allow users to transform the test expression for files
1 parent 681ae1a commit 08f556a

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
@@ -468,8 +468,9 @@ Workers are automatically recycled when they exceed memory limits to prevent out
468468
issues during long test runs. The memory limit is set based on system architecture.
469469
"""
470470
function runtests(mod::Module, ARGS; test_filter = Returns(true), RecordType = TestRecord,
471-
custom_tests::Dict{String, Expr}=Dict{String, Expr}(), init_code = :(),
472-
test_worker = Returns(nothing), stdout = Base.stdout, stderr = Base.stderr)
471+
custom_tests::Dict{String, Expr} = Dict{String, Expr}(), test_transform = (test, expr) -> expr,
472+
init_code = :(), test_worker = Returns(nothing),
473+
stdout = Base.stdout, stderr = Base.stderr)
473474
#
474475
# set-up
475476
#
@@ -538,9 +539,10 @@ function runtests(mod::Module, ARGS; test_filter = Returns(true), RecordType = T
538539

539540
append!(tests, files)
540541
for file in files
541-
test_runners[file] = quote
542+
expr = quote
542543
include($(joinpath(WORKDIR, file * ".jl")))
543544
end
545+
test_runners[file] = test_transform(file, expr)
544546
end
545547
end
546548
## finalize
@@ -575,7 +577,6 @@ function runtests(mod::Module, ARGS; test_filter = Returns(true), RecordType = T
575577
jobs = clamp(jobs, 1, length(tests))
576578
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.")
577579
workers = addworkers(min(jobs, length(tests)))
578-
nworkers = length(workers)
579580

580581
t0 = time()
581582
results = []

0 commit comments

Comments
 (0)