I want to do some testing of changes to a package I’ve
deved. I activate the package environment, but it doesn’t have some imported packages I want to use during testing. (For concreteness, I’m working on
ModelingToolkit and I want to use
OrdinaryDiffEq.) Now, I see that there’s a test target in the package’s
Project.toml which includes
activate test but I got:
(ModelingToolkit) pkg> activate test
Activating new project at `C:\Users\lucas\Documents\Code\Jdev\ModelingToolkit\test`
which is not what I intended. What should I be doing instead? I don’t think I should be adding
OrdinaryDiffEq to the base environment of
ModelingToolkit here. (First of all, it’s not meant to be a dependency, and second, IDK if I’ll get the right version number.)
My workaround is to
activate the test environment,
I have utility functions for this in my startup file. It is kind of a hack, but it works.
function put_in_load_path!(dir = "..", pos = 2)
if dir ∈ LOAD_PATH
@warn "$(dir) is already in LOAD_PATH"
insert!(LOAD_PATH, pos, dir)
function del_in_load_path!(dir = "..")
pos = findfirst(isequal(dir), LOAD_PATH)
if pos ≡ nothing
@warn "$(dir) is not in LOAD_PATH"
Yup, this is the winner for sure, and doesn’t require any non-dev tool packages in your global environment. How to use VSCode and REPL to write and test a package? - #4 by jlperla writes up what I found to be the easiest workflow. If a package doesn’t have a
test/Project.toml but has it embedded in the main Project file, I think TestEnv is still supposed to work.
Yes, it works for both cases