Testing package where the test depends on local dev'ed package fails in Julia 1.4.2 with ERROR: can not merge projects

I have a package (say AAA) where the package itself and the tests depend on a local dev’ed package (BBB). Accordingly, I have package BBB both in AAA’s environment and in AAA/test environment like this:

Project AAA v0.1.0
Status `C:\Data\Projects\AAA\Project.toml`
  [781ca222] BBB v0.5.19 [`..\BBB`]
  [a93c6f00] DataFrames v0.21.2

and

Status `C:\Data\Projects\AAA\test\Project.toml`
  [781ca222] BBB v0.5.19 [`..\..\BBB`]
  [a93c6f00] DataFrames v0.21.2
  [8dfed614] Test

When I try to test package AAA using Julia 1.4.2, I get

(AAA) pkg> test
    Testing AAA
ERROR: can not merge projects

The same test runs fine in Julia 1.3.1. So something seems to have changed between 1.3.1 and 1.4.2. How can this be resolved?

This seems to affect local dev’ed packages. Equivalent tests using for example DataFrames works fine.

1 Like

Update: The problem goes away, if I use the old style test environment specification for package AAA, i.e., when I remove Project.toml and Manifest.toml from AAA/test and add

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]

to AAA’s Project.toml.

Unfortunately, I’m not sufficiently familiar with the package manager details to know what exaclty is meant by ERROR: can not merge projects (there is no further information). I can only guess that the package manager tries to “merge” package AAA’s normal and test environments when the test directory contains a Project.toml. Then the package manager might get confused because there are references to package BBB with different path specifications (../BBB and ../../BBB). Could this be an explanation?

Although I have a workaround at the moment (use old style test environment spec in AAA), I’d rather stick to the new style, since old style will not be supported from a certain point onward.

I’d appreciate any insight whether this is a bug or a feature or whether my settings are just incorrect somewhere.

Thanks

2 Likes

You’re not the first: https://github.com/JuliaLang/Pkg.jl/issues/1585

The recommendation: Don’t use the Test-Project approach.

3 Likes

Thanks a lot for the pointer @laborg. Hadn’t seen this one. Good to know it’s a known issue and it’s being worked on.