Skip to content

Commit

Permalink
Increase a testset isolation (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
00vareladavid authored and KristofferC committed Jul 27, 2018
1 parent ca7a692 commit c8cd07b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stdlib/Pkg/test/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ end
end

temp_pkg_dir() do project_path
cd(project_path) do
with_pkg_env(project_path; change_dir=true) do;
withenv("USER" => "Test User") do
pkg"generate HelloWorld"
LibGit2.close((LibGit2.init(".")))
Expand Down
13 changes: 13 additions & 0 deletions stdlib/Pkg/test/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,16 @@ function with_temp_env(f, env_name::AbstractString="Dummy")
Pkg.activate()
end
end

function with_pkg_env(fn::Function, path::AbstractString="."; change_dir=false)
Pkg.activate(path)
try
if change_dir
cd(fn, path)
else
fn()
end
finally
Pkg.activate()
end
end

0 comments on commit c8cd07b

Please sign in to comment.