How to use local version of test dependency?

gdalle
Mon, 05 Aug 2024 08:42:30 +0000
General Usage

I have a monorepo with two packages side by side: DifferentiationInterface.jl (DI) and DifferentiationInterfaceTest.jl (DIT). The tests of DI require DIT, and when I run CI, I want to be sure to always install the local version of DIT from the repo, not the stable version from the registry.

The problem I see is that I cannot access the test environment of DI before running Pkg.test.

Sofar I have been doing Pkg operations in the DI runtests.jl file, which is very ugly.

I tried doing those in the CI workflow before the testing step, but I end up adding DIT as a dependency of the DI package itself, which is not what I want and makes Aqua.jl angry (Put local installation in CI by gdalle · Pull Request #402 · gdalle/DifferentiationInterface.jl · GitHub)

I know that I could create a test/Project.toml and the associated test/Manifest.toml then use Pkg.test(allow_reresolve=false), but this way of specifying test dependencies is rather brittle and I’ve been steering clear sofar ("cannot merge projects" error · Issue #1585 · JuliaLang/Pkg.jl · GitHub).

Has anyone encountered this problem before?

1 post - 1 participant