Proper way to use Pkg.test

I’m new to Julia and doing some development work on an existing package RData.

I am attempting to run Pkg.test, and I’m a little confused as to why my dev environment cannot be located.

I’ve created the directory: dvl/julia.packages and added that to my LOAD_PATH (via startup.jl)

~$ cat .julia/config/startup.jl
push!(LOAD_PATH, “/home/warmstrong/dvl/julia.packages”)

then I cloned my github project to that dir, made changes, etc.

In my attempt to run the testsuite I do the following:
(from a clean session)

julia> using Pkg

julia> Pkg.test(“RData”)
ERROR: The following package names could not be resolved:

  • RData (not found in project or manifest)
    Please specify by known name=uuid.
    Stacktrace:
    [1] pkgerror(::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:120
    [2] #ensure_resolved#43(::Bool, ::Function, ::Pkg.Types.EnvCache, ::Array{Pkg.Types.PackageSpec,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:898
    [3] ensure_resolved at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:868 [inlined]
    [4] #test#42(::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:269
    [5] #test#41 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:258 [inlined]
    [6] test at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:255 [inlined]
    [7] #test#40 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:254 [inlined]
    [8] test at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:254 [inlined]
    [9] #test#39(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:253
    [10] test(::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:253
    [11] top-level scope at none:0

julia> LOAD_PATH
4-element Array{String,1}:
“@”
@v#.#”
@stdlib
“/home/warmstrong/dvl/julia.packages”

julia> exit()
~$ \ls -d /home/warmstrong/dvl/julia.packages/RData.jl
/home/warmstrong/dvl/julia.packages/RData.jl

How do I tell Julia about this dev directory in addition to adding it to the LOAD_PATH?

Thanks!

The package have to be enabled in your active environment. Have you done Pkg.develop("<path-to-package>")?
But the easier way is to do ]add RData (adds the current release to the environment) and then ]develop RData (creates (if not done before) ~/.julia/dev/RData folder, checks out the master branch and updates the environment manifest to use this location). You can then use your git tool of choice to configure the remotes and check out your development branch.

ok.

I tried the Pkg.develop method, but I get some errors:

julia> Pkg.develop(“dvl/julia.packages/RData.jl”)
ERROR: dvl/julia.packages/RData.jl is not a valid packagename
Stacktrace:
[1] pkgerror(::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:120
[2] check_package_name(::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:22
[3] iterate at ./generator.jl:47 [inlined]
[4] collect(::Base.Generator{Array{String,1},typeof(Pkg.API.check_package_name)}) at ./array.jl:627
[5] #add_or_develop#11 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:28 [inlined]
[6] #add_or_develop at ./none:0 [inlined]
[7] #add_or_develop#10(::Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol},NamedTuple{(:mode, :shared),Tuple{Symbol,Bool}}}, ::Function, ::String) at
/buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:27
[8] #add_or_develop at ./none:0 [inlined]
[9] #develop#19 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:70 [inlined]
[10] develop(::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:70
[11] top-level scope at none:0

Yet, when I attempt to just use the package it’s fine.

julia> using RData
[ Info: Recompiling stale cache file /home/warmstrong/.julia/compiled/v1.1/RData.ji for RData [top-level]

julia>

I have to say, it’s a bit unusual to develop out of a dot directory. everything else I do is out of my dvl folder. I can work with it if that’s the only way to do it, but I’m not sure it makes sense. Maybe I’ll just slink it for now to get it to work…

Also, what can I do so that my posts do not need to be moderator approved first?

Post twice — you’re done :slight_smile:

.julia$ pwd
/home/warmstrong/.julia
.julia$ ls -d dev
lrwxrwxrwx 1 warmstrong domain users 35 Nov 15 12:10 dev → /home/warmstrong/dvl/julia.packages
.julia$

hmm…

julia> using Pkg

julia> Pkg.test(“RData”)
Updating registry at ~/.julia/registries/General
Updating git-repo https://github.com/JuliaRegistries/General.git
ERROR: Package RData did not provide a test/runtests.jl file

test$ pwd
/home/warmstrong/dvl/julia.packages/RData.jl/test
test$ ls runtests.jl
-rw-r–r-- 1 warmstrong domain users 60 Nov 15 08:28 runtests.jl
test$

Have you tried renaming it to RData? That’s how Julia expects it.

Pkg.test() uses the information from the Project.toml and Manifest.toml in your active environment Pkg.status() (or ]st) shows a summary of what’s in your Manifest.toml and where it’s located.

yes! that was it.

Thanks!

dev$ pwd
/home/warmstrong/.julia/dev
dev$ ls
total 0
lrwxrwxrwx 1 warmstrong domain users 45 Nov 15 12:22 RData → /home/warmstrong/dvl/julia.packages/RData.jl/
dev$