How to use local version of test dependency?

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.

Has anyone encountered this problem before?