Preferences.jl icon indicating copy to clipboard operation
Preferences.jl copied to clipboard

No preferences loaded when testing package

Open pxl-th opened this issue 3 years ago • 2 comments

I encounter this bug on Julia 1.7.3. Julia 1.8.0-rc1 does not have this.

Here's MWE: R.tar.gz

The package is very minimal, it only loads preference const BACKEND = @load_preference("backend") from LocalPreferences.toml. When using R directly, it loads preferences, but when ]testing package, BACKEND is nothing.

Tracing what happens during @load_preference I've found out that project_dir does not contain LocalPreferences.toml:

  • 1.7.3: readdir(project_dir) = ["Manifest.toml", "Project.toml"]
  • 1.8.0-rc1: readdir(project_dir) = ["JuliaLocalPreferences.toml", "Manifest.toml", "Project.toml"]

pxl-th avatar Jul 17 '22 11:07 pxl-th

https://github.com/JuliaPackaging/Preferences.jl/issues/39#issuecomment-1166374030 again

giordano avatar Jul 17 '22 11:07 giordano

#39 (comment) again

I did try to specify R in [extras], but still get the same result

pxl-th@Atom:~/Downloads/R$ cat test/Project.toml 
[deps]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[extras]
R = "0c099881-77d4-44cc-8664-2f9c2902eb5d"
pxl-th@Atom:~/Downloads/R$ jl
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.7.3 (2022-05-06)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(R) pkg> test
     Testing R
      Status `/tmp/jl_24AvVz/Project.toml`
  [0c099881] R v0.1.0 `~/Downloads/R`
  [8dfed614] Test `@stdlib/Test`
      Status `/tmp/jl_24AvVz/Manifest.toml`
  [21216c6a] Preferences v1.3.0
  [0c099881] R v0.1.0 `~/Downloads/R`
  [2a0f44e3] Base64 `@stdlib/Base64`
  [ade2ca70] Dates `@stdlib/Dates`
  [b77e0a4c] InteractiveUtils `@stdlib/InteractiveUtils`
  [56ddb016] Logging `@stdlib/Logging`
  [d6f4376e] Markdown `@stdlib/Markdown`
  [de0858da] Printf `@stdlib/Printf`
  [9a3f8284] Random `@stdlib/Random`
  [ea8e919c] SHA `@stdlib/SHA`
  [9e88b42a] Serialization `@stdlib/Serialization`
  [fa267f1f] TOML `@stdlib/TOML`
  [8dfed614] Test `@stdlib/Test`
  [4ec0a83e] Unicode `@stdlib/Unicode`
     Testing Running tests...
readdir(project_dir) = ["Manifest.toml", "Project.toml"]
Base.collect_preferences(project_toml, UUID) = Dict{String, Any}[]
R.BACKEND = nothing
     Testing R tests passed 

pxl-th avatar Jul 17 '22 12:07 pxl-th