diff --git a/src/VisualRegressionTests.jl b/src/VisualRegressionTests.jl index a81851d..545ed93 100644 --- a/src/VisualRegressionTests.jl +++ b/src/VisualRegressionTests.jl @@ -6,6 +6,7 @@ using ImageBase using ImageDistances using ImageFiltering +const path = mktempdir() # --------------------------------------------- struct VisualTest @@ -18,7 +19,7 @@ struct VisualTest end function VisualTest(testFunction::Function, refFilename::AbstractString, args...; kw...) - VisualTest(tempname() * ".png", testFunction, args, kw, refFilename) + VisualTest(joinpath(path, tempname() * ".png"), testFunction, args, kw, refFilename) end # --------------------------------------------- diff --git a/src/macros.jl b/src/macros.jl index 5ddca36..e7ffd4c 100644 --- a/src/macros.jl +++ b/src/macros.jl @@ -1,6 +1,6 @@ macro visualtest(testfun, refname, popup=true, tol=1e-3) esc(quote - testFilename = tempname()*".png" + testFilename = joinpath($path, tempname() * ".png") $testfun(testFilename) @test test_images(testFilename, $refname, popup=$popup, tol=$tol) |> success end) @@ -8,7 +8,7 @@ end macro plottest(plotfun, refname, popup=true, tol=1e-3) esc(quote - testFilename = tempname()*".png" + testFilename = joinpath($path, tempname() * ".png") if $plotfun isa Function $plotfun() else # function body diff --git a/test/runtests.jl b/test/runtests.jl index 8d870db..ac8173b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -8,7 +8,7 @@ import FileIO, TestImages img = TestImages.testimage("cameraman") # save a temporary copy -reffn = tempname() * ".png" +reffn = joinpath(path, tempname() * ".png") FileIO.save(reffn, img) # this is the test function, which saves an image to the given location