Run Pkg.test but not in a separate process

I would like to have a script that runs my test with a few different settings (basically ENV variables). For that I would like to use Pkg.test (instead of the ] test MyPackage which might be a bit manual for this). However, I would prefer the test to run (a) in the test environment for sure but (b) in the same process as my main script (that is just easier to cancel) – is there a way to issue Pkg.test such that is does not spawn a new process but merely activates the test environment before running? That would be great.

I don’t think Pkg has an option like that. You could use TestEnv.jl to activate the test environment, and replicate what Pkg.test does (--check-bounds=yes, include runtests.jl, etc; see


TestEnv sounds like a very good idea. The main thing I was missing (when running runtests myself) was the environment.