Errors when testing unregistered custom package (because of non-ASCII characters, it seems)

benjamin@benjamin-pc:~/Projets/test$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.4.2 (2020-05-23)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(@v1.4) pkg> generate GoodPackage
 Generating  project GoodPackage:
    GoodPackage/Project.toml
    GoodPackage/src/GoodPackage.jl

(@v1.4) pkg> generate BadPackæge
 Generating  project BadPackæge:
    BadPackæge/Project.toml
    BadPackæge/src/BadPackæge.jl

(@v1.4) pkg> activate GoodPackage
 Activating environment at `~/Projets/test/GoodPackage/Project.toml`

julia> cd("GoodPackage/")

(GoodPackage) pkg> activate ./test
 Activating new environment at `~/Projets/test/GoodPackage/test/Project.toml`

(test) pkg> add Test
   Updating registry at `~/.julia/registries/General`
   Updating git-repo `https://github.com/JuliaRegistries/General.git`
  Resolving package versions...
   Updating `~/Projets/test/GoodPackage/test/Project.toml`
  [8dfed614] + Test 
   Updating `~/Projets/test/GoodPackage/test/Manifest.toml`
  [2a0f44e3] + Base64 
  [8ba89e20] + Distributed 
  [b77e0a4c] + InteractiveUtils 
  [56ddb016] + Logging 
  [d6f4376e] + Markdown 
  [9a3f8284] + Random 
  [9e88b42a] + Serialization 
  [6462fe0b] + Sockets 
  [8dfed614] + Test 

julia> println(read("test/runtests.jl", String))
using Test
using GoodPackage

GoodPackage.greet()

@test true


(test) pkg> activate .
 Activating environment at `~/Projets/test/GoodPackage/Project.toml`

(GoodPackage) pkg> test
   Updating registry at `~/.julia/registries/General`
   Updating git-repo `https://github.com/JuliaRegistries/General.git`
   Updating `~/Projets/test/GoodPackage/Project.toml`
 [no changes]
   Updating `~/Projets/test/GoodPackage/Manifest.toml`
 [no changes]
    Testing GoodPackage
Status `/tmp/jl_yTuxRY/Manifest.toml`
  [d2c24135] GoodPackage v0.1.0 [`~/Projets/test/GoodPackage`]
  [2a0f44e3] Base64 
  [8ba89e20] Distributed 
  [b77e0a4c] InteractiveUtils 
  [56ddb016] Logging 
  [d6f4376e] Markdown 
  [9a3f8284] Random 
  [9e88b42a] Serialization 
  [6462fe0b] Sockets 
  [8dfed614] Test 
Hello World!    Testing GoodPackage tests passed 

julia> cd("..")

(GoodPackage) pkg> activate BadPackæge
 Activating environment at `~/Projets/test/BadPackæge/Project.toml`

julia> cd("BadPackæge/")

(BadPackæge) pkg> activate ./test
 Activating new environment at `~/Projets/test/BadPackæge/test/Project.toml`

(test) pkg> add Test
  Resolving package versions...
   Updating `~/Projets/test/BadPackæge/test/Project.toml`
  [8dfed614] + Test 
   Updating `~/Projets/test/BadPackæge/test/Manifest.toml`
  [2a0f44e3] + Base64 
  [8ba89e20] + Distributed 
  [b77e0a4c] + InteractiveUtils 
  [56ddb016] + Logging 
  [d6f4376e] + Markdown 
  [9a3f8284] + Random 
  [9e88b42a] + Serialization 
  [6462fe0b] + Sockets 
  [8dfed614] + Test 

julia> println(read("test/runtests.jl", String))
using Test
using BadPackæge

BadPackæge.greet()

@test true


(test) pkg> activate .
 Activating environment at `~/Projets/test/BadPackæge/Project.toml`

(BadPackæge) pkg> test
   Updating registry at `~/.julia/registries/General`
   Updating git-repo `https://github.com/JuliaRegistries/General.git`
   Updating `~/Projets/test/BadPackæge/Project.toml`
 [no changes]
   Updating `~/Projets/test/BadPackæge/Manifest.toml`
 [no changes]
    Testing BadPackæge
Status `/tmp/jl_eVXLCZ/Manifest.toml`
  [de51fa18] BadPackæge v0.1.0 [`~/Projets/test/BadPackæge`]
  [2a0f44e3] Base64 
  [8ba89e20] Distributed 
  [b77e0a4c] InteractiveUtils 
  [56ddb016] Logging 
  [d6f4376e] Markdown 
  [9a3f8284] Random 
  [9e88b42a] Serialization 
  [6462fe0b] Sockets 
  [8dfed614] Test 
ERROR: LoadError: ArgumentError: Package BadPackæge not found in current path:
- Run `import Pkg; Pkg.add("BadPackæge")` to install the BadPackæge package.

Stacktrace:
 [1] require(::Module, ::Symbol) at ./loading.jl:892
 [2] include(::String) at ./client.jl:439
 [3] top-level scope at none:6
in expression starting at /home/benjamin/Projets/test/BadPackæge/test/runtests.jl:2
ERROR: Package BadPackæge errored during testing

(BadPackæge) pkg> 

So, because of the æ character in package name (mine starts by Œ, but I renamed it to make it easier, which was not the best idea here), seemingly unrelated error is thrown.

Thank you. It was a good advice to try to restart a test project to compare little by little.

I created an issue on Julia Github for that.

still, you are not supposed to activate the toml in test/ directory. just look at all the registered packages. they don’t use that project.toml in the test directory. you are supposed to activate the package itself.

follow this: 5. Creating Packages · Pkg.jl

Are you really sure? On the link you gave me, and that I linked several times because I followed it, there is this paragraph:

To add a test-specific dependency, i.e. a dependency that is available only when testing, it is thus enough to add this dependency to the test/Project.toml project. This can be done from the Pkg REPL by activating this environment, and then use add as one normally does. Lets add the Test standard library as a test dependency:

(HelloWorld) pkg> activate ./test
[ Info: activating environment at `~/HelloWorld/test/Project.toml`.

(test) pkg> add Test
 Resolving package versions...
  Updating `~/HelloWorld/test/Project.toml`
  [8dfed614] + Test
  Updating `~/HelloWorld/test/Manifest.toml`
  [...]

And to be sure we understand each other enough: I never activate MyPackage/test for test, but just to add some test-specific dependencies, so it is made once during the prototyping (in order to add Test package itself, because I don’t need it in MyPackage, just in MyPackage/test), as you can see on all of my messages.

In Julia 1.0 and Julia 1.1 test-specific dependencies are added to the main Project.toml . To add Markdown and Test as test-dependencies, add the following:

[extras]
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Markdown", "Test"]

ok, seems recently they allow now or encourage Project.toml in test/

1 Like