-
-
Notifications
You must be signed in to change notification settings - Fork 270
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
fix using local projects when testing #311
Conversation
src/Operations.jl
Outdated
@@ -777,7 +777,7 @@ function with_dependencies_loadable_at_toplevel(f, mainctx::Context, pkg::Packag | |||
write_env(localctx, display_diff = false) | |||
will_resolve && build_versions(localctx, new) | |||
sep = Sys.iswindows() ? ';' : ':' | |||
withenv(f, "JULIA_LOAD_PATH" => "$tmpdir$sep$(Types.stdlib_dir())") | |||
withenv(f, "JULIA_LOAD_PATH" => "@|$tmpdir$sep$(Types.stdlib_dir())") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is certainly the right fix to add the current env to the path (i.e. look in parent directories for something that looks like a project or a git repo). I'm not quite sure that I understand the scenario that @staticfloat is hitting or why this is the right fix. Can you explain a bit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes; this is for the BinaryProvider
tests; one of the things I wanted to test was that the whole Pkg.*
machinery works, so I have a package called LibFoo.jl
embedded within BinaryProvider/test
. With Pkg2
; getting Pkg.build()
and Pkg.test()
to be able to reach this package is pretty easy; you can just set JULIA_LOAD_PATH
and be on your way. 0.7 makes it a little more complicated because doing so will allow LibFoo
to be loaded, but LibFoo
will then not be able to load Compat
or BinaryProvider
. What I ended up doing was adding a Project.toml
for LibFoo
as well, and that convinced Pkg3
to expose Compat
and BinaryProvider
to LibFoo.jl
(Which is such an amazingly simple and staightforward fix, I love it) but that only worked when running directly from the command line, e.g. julia test/runtests.jl
from within the BinaryProvider
directory would be able to pass all tests, including those of the nested LibFoo.jl
. Running Pkg.test("BinaryProvider")
would fail and be unable to load LibFoo.jl
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem was the current env was not in the LOAD_PATH when testing so even though @staticfloat cd:ed to a path with a Project file, that wasn't picked up.
Have to diagnose the test error here though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I think I want $sep
here.
How can I test this locally? Is there a way to override the |
Yes, put the Pkg repo somewhere, delete the |
Confirmed that this fixes all my |
Codecov Report
@@ Coverage Diff @@
## master #311 +/- ##
==========================================
+ Coverage 88.71% 88.78% +0.06%
==========================================
Files 16 16
Lines 2739 2747 +8
==========================================
+ Hits 2430 2439 +9
+ Misses 309 308 -1
Continue to review full report at Codecov.
|
Woot, back to all green again here. |
* fix using local projects when testing
Fixes #306. cc @staticfloat