tracks/julia/runtests.jl in trackler-2.2.1.37 vs tracks/julia/runtests.jl in trackler-2.2.1.38
- old
+ new
@@ -4,15 +4,15 @@
# When testing the example solution, all tests must pass, even ones marked as skipped or broken.
# The track user will not be affected by this.
# Overwrite @test_skip, @test_broken with @test
macro test_skip(ex)
- @test eval(ex)
+ @test eval(current_module(), ex)
end
macro test_broken(ex)
- @test eval(ex)
+ @test eval(current_module(), ex)
end
for (root, dirs, files) in walkdir("exercises")
for exercise in dirs
# Allow only testing specified execises
@@ -30,10 +30,12 @@
cp(joinpath(exercise_path, "runtests.jl"), joinpath(temp_path, "runtests.jl"))
try
# Run the tests
@testset "$exercise example" begin
- include(joinpath(temp_path, "runtests.jl"))
+ # Run the tests within an anonymous module to prevent definitions from
+ # one exercise leaking into another.
+ eval(Module(), :(include(joinpath($temp_path, "runtests.jl"))))
end
finally
# Delete the temporary directory
rm(temp_path, recursive=true)
end