Deps and test folders in package

I am building my own package according to https://pkgdocs.julialang.org/v1/creating-packages/. I am wondering at which point the deps/ and test/ folders should appear in the package directory?

after “generate mypkg” I have the src/ folder only.

julia> print(read("test/runtests.jl", String))
ERROR: SystemError: opening file "test/runtests.jl": No such file or directory

Not exactly answering your question, but I think most people use PkgTemplates.jl to generate packages. This auto generates test and a few other things.
I think there is a step missing in the docs (between build and testing) that probably would tell the user to create the test dir manually.

3 Likes

You need the test directory as soon as you have some tests, preferably right from the start.

Ideally you don’t need a deps directory at all. If you don’t know with certainty that you must have some kind of build step, you won’t need it.

1 Like

Ok! I now make test/runtests.jl manually:

#file runtests.jl
using Test
using mypkg

println("hello!")

But when I try to run test:

(@v1.5) pkg> activate ./test
 Activating environment at `~/data/pkgtest/mypkg/test/Project.toml`

julia> include("test/runtests.jl")
ERROR: LoadError: ArgumentError: Package mypkg not found in current path:
- Run `import Pkg; Pkg.add("mypkg")` to install the mypkg package.