[pkg test] Error on explicit mention of tested package in Project.toml

I’m describing my test-specific dependencies (julia 1.4) in test/Project.toml according to the docs. It’s also mentioned in the docs that:

Pkg will add the tested package itself implictly

I’d like however to be able to easily run my test scripts independently from Pkg.test for greater flexibility. I tried therefore adding an explicit dependency to the package I’m developing in test/Project.toml, since after all it sounds like something that Pkg does anyway when testing.

Sure enough, I can now run my test scripts independently. However when I actually use them through Pkg.test I get the following error:

ERROR: can not merge projects

Is this a feature or a bug?

Is there a better way to do what I want to do?

Thanks! :smiley:

1 Like

Ummm, for all my modules I have Test as a dependency in the test/Project.toml file and I don’t have issues. Do you get some sort of stack trace?

I’m not referring to Test, but to the package I’m testing.

I’m developing package X. test/Project.toml looks like:

[deps]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
X = "db654dba-670c-566a-9226-64313b881ded"

I’m talking about the last line: having the under development package X as a dependency in its own test environment.

Sorry, I understand now. You might be able to do something like:

using Pkg

Pkg.activate("test")
Pkg.develop("/path/to/X")
Pkg.instantiate();

include("runtests.jl")

Pkg.rm("X")

I’m not 100% that will work though.

it looks that it is indeed a bug: https://github.com/JuliaLang/Pkg.jl/issues/1585