-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supporting packages whose tests depend on Preferences #59
Comments
We will have to locate which thing is present in |
I think for preferences that's a question of traversing the same preferences path that the loading system uses. I'm not deeply (or even shallowly 🙂 ) familiar with that part of |
I wanted to voice support for this issue as I usually disable precompilation for packages I develop, via preferences. Those are then not picked up anymore when using |
I tried to workout where in the Pkg.test code this was being enabled but couldn't find it. If someone can point out the Pkg code that ties this I can copy it across |
I don't understand how any of this works, but here's one simple example. It's related to ForwardDiff, which I use just as a quick-and-dirty test for some analytic derivatives. But I need the "NaN-safe mode", which apparently can't be enabled dynamically, but must be already turned on in
I have this in my log(ForwardDiff.Dual{:tag}(0.0, 0.0)) The "wrong" answer (returned when cp("test/LocalPreferences.toml", joinpath(dirname(TestEnv.activate()),"LocalPreferences.toml")) Love this package, BTW! :) |
This might actually be the correct solution (if we did that automatically). |
As far as I understand, there can either be keys stored in a sidecar file,
So you would only get the exact same behavior if at the time you run tests manually after having |
From a quick test with a random package that prints out the load path during testing, I get this in the normal REPL session: julia> LOAD_PATH
3-element Vector{String}:
"@"
"@v#.#"
"@stdlib" And this from the LOAD_PATH = ["@", "/var/folders/z5/r5q6djwn5g10k3w279bn37700000gn/T/jl_U1R2Hh"] As the paths differ, preferences might be different between On the other hand, now that I think about it, you would not want your tests to be vulnerable to some random dependency's preferences, so if there is a setting that must not be changed from within a higher-level env, then you should probably set that preference yourself in |
I ran into this problem as well. Mandatory preferences for a Julia package that I keep in a When creating the sandbox test environment, Pkg collects all preferences |
I agree that would be the correct approach. |
In principle it is possible that some packages may rely on configuration to pass their tests. If that configuration occurs via Preferences.jl, given that Preferences is path-based it seems likely to be necessary to find and copy the LocalPreferences.toml file to the new project directory.
I don't yet have a MWE, but I have a not-yet-public package that involves communication with a SQL database, and I handle the configuration of this interaction via Preferences. The package passes tests with
Pkg.test()
(following a custom line in my CI.yml file that generates the right LocalPreferences) but I have not found an incantation that works with TestEnv.The text was updated successfully, but these errors were encountered: