In our package, we have a number of dependencies used for testing only. For end users of our package, we don’t wish to enforce those dependencies. It seems that the suggested way of achieving this is using Test-specific dependencies.
The problem with that technique is that, as far as I can tell, it only works when running the test suite through
Pkg.test(), by creating a new temporary environment. But in our package, we have various ways of testing our code: the standard test suite, a script that allows testing a subset of the code, more extensive benchmarks, plotting the output, etc. These currently live as independent scripts in the
test/ directory, e.g.
Now we’re wondering what the best way is to have a separate set of dependencies for those scripts only? Ideally an independent set of dependencies per script (in particular, we don’t want heavy dependencies like plotting unless really needed). One way is to programmatically add dependencies in the scripts themselves, so for example
runbenchmark.jl could start with:
haskey(Pkg.installed(), "BenchmarkTools") || Pkg.add("BenchmarkTools")
A major disadvantage is that it modifies the
Project.toml file. Any other ideas?