diff --git a/src/ParallelTestRunner.jl b/src/ParallelTestRunner.jl index ea4abed..bec95ff 100644 --- a/src/ParallelTestRunner.jl +++ b/src/ParallelTestRunner.jl @@ -146,10 +146,10 @@ function runtest(::Type{TestRecord}, f, name, init_code) wait(@spawnat 1 print_testworker_started(name, id)) end + Core.eval(mod, init_code) data = @eval mod begin GC.gc(true) Random.seed!(1) - $init_code res = @timed @testset $name begin $f diff --git a/test/basic.jl b/test/basic.jl new file mode 100644 index 0000000..8a617b3 --- /dev/null +++ b/test/basic.jl @@ -0,0 +1 @@ +@test true diff --git a/test/init.jl b/test/init.jl deleted file mode 100644 index c83a2af..0000000 --- a/test/init.jl +++ /dev/null @@ -1 +0,0 @@ -@test should_be_defined() diff --git a/test/runtests.jl b/test/runtests.jl index e5b2257..71f9757 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -2,16 +2,21 @@ using ParallelTestRunner pushfirst!(ARGS, "--verbose") +runtests(ARGS) + +# custom tests, and initialization code init_code = quote using Test should_be_defined() = true -end - -runtests(ARGS; init_code) + macro should_also_be_defined() + return :(true) + end +end custom_tests = Dict( "custom" => quote @test should_be_defined() + @test @should_also_be_defined() end ) runtests(ARGS; init_code, custom_tests)