Skip to content

Commit 40b10fe

Browse files
committed
Make activate set not mess with LOAD_PATH
1 parent 8d8c90c commit 40b10fe

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/activate_set.jl

+1-8
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ function activate(pkg::AbstractString=current_pkg_name())
4949

5050
Types.write_manifest(working_manifest, tmp_manifest)
5151

52-
# sandbox
53-
push!(empty!(LOAD_PATH), "@", tmp)
54-
Base.ACTIVE_PROJECT[] = nothing
52+
Base.ACTIVE_PROJECT[] = tmp_project
5553

5654
temp_ctx = Context()
5755
temp_ctx.env.project.deps[pkgspec.name] = pkgspec.uuid
@@ -77,11 +75,6 @@ function activate(pkg::AbstractString=current_pkg_name())
7775
end
7876
end
7977
write_env(temp_ctx.env; update_undo=false)
80-
81-
# update enviroment variables
82-
path_sep = Sys.iswindows() ? ';' : ':'
83-
ENV["JULIA_LOAD_PATH"] = "@$(path_sep)$(tmp)"
84-
delete!(ENV, "JULIA_PROJECT")
8578

8679
return Base.active_project()
8780
end

test/activate_set.jl

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
@testset "activate_set.jl" begin
22
@testset "activate [extras]" begin
33
orig_project_toml_path = Base.active_project()
4+
push!(LOAD_PATH, mktempdir()) # put something weird in LOAD_PATH for testing
5+
orig_load_path = Base.LOAD_PATH
46
try
57
TestEnv.activate("ChainRulesCore")
68
new_project_toml_path = Base.active_project()
79
@test new_project_toml_path != orig_project_toml_path
10+
@test orig_load_path Base.LOAD_PATH
811

9-
@eval using StaticArrays
12+
@eval using StaticArrays # From ChainRulesCore [extras] Project.toml
13+
@test isdefined(@__MODULE__, :StaticArrays)
14+
15+
@eval using Compat # from ChainRulesCore Project.toml
1016
@test isdefined(@__MODULE__, :StaticArrays)
1117
finally
1218
Pkg.activate(orig_project_toml_path)
@@ -15,14 +21,18 @@
1521

1622
@testset "activate test/Project" begin
1723
orig_project_toml_path = Base.active_project()
24+
push!(LOAD_PATH, mktempdir()) # put something weird in LOAD_PATH for testing
25+
orig_load_path = Base.LOAD_PATH
1826
try
1927
# YAXArrays has a test/Project.toml, which contains CSV
2028
TestEnv.activate("YAXArrays")
2129
new_project_toml_path = Base.active_project()
2230
@test new_project_toml_path != orig_project_toml_path
31+
@test orig_load_path Base.LOAD_PATH
2332

2433
@eval using CSV
2534
@test isdefined(@__MODULE__, :CSV)
35+
2636
finally
2737
Pkg.activate(orig_project_toml_path)
2838
end

0 commit comments

Comments
 (0)