Skip to content
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

Merged
merged 5 commits into from
May 28, 2018
Merged

Conversation

KristofferC
Copy link
Member

Fixes #306. cc @staticfloat

@@ -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())")
Copy link
Member

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?

Copy link
Member

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.

Copy link
Member Author

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...

Copy link
Member Author

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.

@staticfloat
Copy link
Member

How can I test this locally? Is there a way to override the Pkg that my local julia master checkout uses?

@KristofferC
Copy link
Member Author

Yes, put the Pkg repo somewhere, delete the uuid = field from the Pkg Project.toml file, cd to the Pkg directory and load Pkg.

@staticfloat
Copy link
Member

Confirmed that this fixes all my BinaryProvider problems. Thanks @KristofferC!

@codecov-io
Copy link

Codecov Report

Merging #311 into master will increase coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/generate.jl 96.42% <ø> (+14.28%) ⬆️
src/Operations.jl 93.59% <100%> (-0.43%) ⬇️
src/Types.jl 92.67% <0%> (ø) ⬆️
src/Pkg2/types.jl 77.77% <0%> (+0.85%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d8a43b...a1e90c1. Read the comment docs.

@KristofferC
Copy link
Member Author

Woot, back to all green again here.

@KristofferC KristofferC merged commit 251d98d into master May 28, 2018
@KristofferC KristofferC deleted the kc/local_projects_test branch May 28, 2018 20:28
fredrikekre pushed a commit that referenced this pull request Oct 15, 2018
* fix using local projects when testing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants