Standard package not found in current path when using Pkg environment

Hi all,

I’m just in the final stages of updating a package for v1.0 (I’m currently testing it on v0.7). My problem is as follows. I start up a fresh REPL session, an hit ] to start the package mode. I activate my package using activate DependentBootstrap. I try to test it using test and get the following error:

(DependentBootstrap) pkg> test
Testing DependentBootstrap
Resolving package versions...
ERROR: LoadError: ArgumentError: Package Random not found in current path:
- Run `Pkg.add("Random")` to install the Random package.

One of the first statements in my runtests.jl file is using Random, which is obviously what is causing the problem. But I can just copy/paste the contents of the runtests.jl file into the REPL and it all works fine, which is what leads me to believe that the problem is something I am not understanding about the Pkg environment.

One final point that may or may not be relevant: I’m currently running the package in develop mode, i.e. I used develop to pull the package from github, and it is currently stored in .julia/dev/DependentBootstrap

Any ideas what is going wrong?

Thanks in advance,

Colin

You need to add Random either as a direct dependency of DependentBootstrap or as a test dependency, see the docs: https://docs.julialang.org/en/v1/stdlib/Pkg/#Test-specific-dependencies-1

2 Likes

Ah thanks I understand now. I’d read this but foolishly didn’t make the connection that it would also apply to the standard package library.

Cheers,

Colin

Thanks! The link was moved here:
https://docs.julialang.org/en/v1.0.0/stdlib/Pkg/#Test-specific-dependencies-1