tl;dr: I’m looking for roughly the equivalent of pytest --pdb
for those familiar with pytest.
I would like to drop into a debugger or infiltrator when a unit test fails. If I run a test and it fails and I can’t immediately figure it out, I rerun the test with @infiltrate
sprinkled in. I feel like it would greatly improve my workflow if I could just have that as an option when I run my unit tests. Then I wouldn’t need to add and remove @infiltrate
.
I was trying to wrap the @test
macro, such that if it returned a fail or error result, it would run @infiltrate
. I haven’t been clever enough to figure out how to do that however.
Edit: After some more thinking, this seems to work for me so far.
using Test
using Infiltrator
macro itest(ex, kws...)
quote
o = @test($(esc(ex)), $(esc.(kws)...))
typeof(o) != Test.Pass && @infiltrate
o
end
end
Then I can just use @itest
instead of @test
.