Aqua.jl tests failing because Aqua not a dependency of root project

I’m trying to add Aqua.jl to my project. As suggested in the Aqua.jl documentation, I have placed Aqua in the test/Project.toml file to fix its version to 0.5. But now the Aqua tests fail if I call julia --project from my project’s root directory and then ]test, because Aqua is listed as a test dependency but not a project dependency:

MyPackage [UUID ...]: Test Failed at /home/max/.julia/packages/Aqua/HWLbM/src/project_extras.jl:13
  Expression: result ⊜ true
   Evaluated: ⟪result: 😭 FAILED: MyPackage [UUID ...]
    Root and test projects are inconsistent.
    Test dependencies not in root project (/home/max/MyProject.jl/Project.toml):
        Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
⟫ ⊜ true

But Aqua isn’t a project dependency on purpose! The only time I want to use Aqua is during testing.

Is this a bug, or am I doing something wrong?

(I notice that other packages with Aqua badges, such as the recently announced ImplicitDifferentiation.jl, list Aqua only in the test dependencies and not in Project.toml.)

https://github.com/JuliaTesting/Aqua.jl/issues/78

1 Like

The solution suggested there is to remove Aqua.jl from test/Project.toml and list it under extras in the main Project.toml instead. But this doesn’t work either: Now running julia --project and ]test gives me

LoadError: ArgumentError: Package Aqua not found in current path.
- Run `import Pkg; Pkg.add("Aqua")` to install the Aqua package.

(this is immediately after running ]add Aqua in my global Julia environment.)

MyProject’s Project.toml looks like this

> cat Project.toml
name = "MyProject"
# ...

[deps]
# ...

[compat]
julia = "1"
#...

[extras]
# ...
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"

[targets]
test = ["Test"]

and I have deleted test/Project.toml (because the only additional package it uses is Aqua).

Is my environment just corrupted somewhere?

You must list the package in the vector of strings under target test also,

1 Like

Can you show your original Project.toml and test/Project.toml? I always add Aqua (and other test dependencies) to test/Project.toml, and it just works fine.

I have deleted test/Project.toml now, and have it working with just Aqua in extras and target. I was never able to get Aqua not to give me the stale dependencies error as long as it was in test/Project.toml. Do you have an example of one of your packages that uses the setup you described?

Sure, see Alexander Plavin / FlexiJoins.jl · GitLab for an example.

1 Like

I had the same issue running Aqua.test_all(MyPackage), but couldn’t use the solution.

Test that failed were:

Aqua.test_project_extras(MyPackage);
Aqua.test_deps_compat(MyPackage);

… but both passed when I added the missing [compat] entries.

I’m on Julia v1.9rc3, and Aqua v0.6.

It is obvious that adding compats would some test_deps_compat, but why so for test_project_extras?

Does it worth a PR or at least a README.md update?