TestItemRunner.jl icon indicating copy to clipboard operation
TestItemRunner.jl copied to clipboard

Memory of previously-opened projects

Open gdalle opened this issue 2 years ago • 1 comments

Something weird happened today while I was running @run_package_tests in the VSCode REPL (I know that's not the intended behavior). Sometimes (not always), TestItemRunner.jl tried to run the testitems from another project that also uses them. That other project was not currently open or even in my workspace. If it helps, I think it only happened when I hit the "up" arrow key to re-execute @run_package_tests. When I executed it with Ctrl + Enter the normal behavior ensued.

gdalle avatar Jun 06 '23 07:06 gdalle

I know this was a while ago, but for what it's worth I was having the same problem today where @run_package_tests would try to run a @testitem from a separate project, even in a new REPL. As a workaround I have this code in my tests/runtests.jl file that I just include from the REPL:

# tests/runtests.jl

using DrWatson, TestItemRunner
@quickactivate "MyProject"

using MyProject

println("Starting tests")
ti = time()

@run_package_tests filter = ti -> (occursin("MyProject", ti.filename)) verbose = true

ti = time() - ti
println("\nTest took total time of:")
println(round(ti / 60; digits = 3), " minutes")

arnold-c avatar Mar 28 '24 03:03 arnold-c

So I don't think we can fix this: when you send a macro like @run_package_test to the VS Code REPL it also sends the file in which that was written to the REPL and stores that, and when you recall it from history then that stored file is used.

I'll close this for now, as the "official' response here is that this macro is not a good way to run tests from the REPL. TestItemRunner2.jl will eventually offer a better experience from the REPL.

davidanthoff avatar Jul 06 '24 19:07 davidanthoff