For complicated packages, I use reasonably complex test utilities, on the level of 500-1k LoC.
I would like to move them into their own module that I can track with Revise.jl. Eg in runtests.jl, I want to have
using MyWonderfulPackage, Test, MyTestUtils
and in some file have
module MyTestUtils
export various, functions
end
The point would be that I can tweak the latter file and Revise would pick up the changes without me re-evaluating the code explictily. (For the purposes of this discussion, assume that I don’t want to use Revise.includet).
How can I do this? I tried various locations for MyTestUtils.jl but using is not finding it. I tried test/MyTestUtils.jl, test/MyTestUtils/src/MyTestUtils.jl, deving the latter, etc.
A while back I wrote a small test suite for one of my packages and since adapted it to one other packages as well.
I personally ended up with a submodule, i.e. MyPackage.Test – which is maybe not the best of names when you export that to global namespace, then maybe in hindsight MyPackage.MyPackageTestSuite or so would be better.
In my scenario I have to test a functionality on several objects.
Thanks! That could work, but it would require adding a new function in two places (the second to be loaded conditionally), it is a but more convoluted than what I am looking for.
Update on my original question: I had a corrupted test/MyTestUtils/Project.toml (probably overenthusiastic use of dev at some point), regenerating that makes the whole thing work. That is, I now have a
Yes, the src/test/test_suite.jl file basically only contains “Headers and Doc strings”, the implementation – since it requires Testy things is in the extension.
I do see, that that is a disadvantage.
I actually started with a module in the test folder as well – though without the “Package-y things” around (so just a TestUtils.jl with a module inside) – and either imported or deved that as well earlier.
The reason for my solution of a submodule came from the point that I would like to also let others use these test tools if they wanted to, and as a submodule it “ships” with the package in a “direct way”. But for sure there might be other use cases you have in mind as well.