Skip to content

Commit e1af8ff

Browse files
authored
Merge pull request #24 from JuliaTesting/ox/port14_loadpath
backport LOADPATH fix
2 parents 3743b1e + cc0000e commit e1af8ff

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "TestEnv"
22
uuid = "1e6cf692-eddd-4d53-88a5-2d735e33781b"
3-
version = "1.4.0"
3+
version = "1.4.1"
44

55
[deps]
66
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

src/activate_set.jl

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

4848
Types.write_manifest(working_manifest, tmp_manifest)
4949

50-
# sandbox
51-
push!(empty!(LOAD_PATH), "@", tmp)
52-
Base.ACTIVE_PROJECT[] = nothing
50+
Base.ACTIVE_PROJECT[] = tmp_project
5351

5452
temp_ctx = Context()
5553
temp_ctx.env.project.deps[pkgspec.name] = pkgspec.uuid
@@ -75,11 +73,6 @@ function activate(pkg::AbstractString=current_pkg_name())
7573
end
7674
end
7775
write_env(temp_ctx.env; update_undo=false)
78-
79-
# update enviroment variables
80-
path_sep = Sys.iswindows() ? ';' : ':'
81-
ENV["JULIA_LOAD_PATH"] = "@$(path_sep)$(tmp)"
82-
delete!(ENV, "JULIA_PROJECT")
8376

8477
return Base.active_project()
8578
end

test/activate_set.jl

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,42 @@
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)
19+
# No longer is enviroment active
20+
@test_throws ArgumentError @eval using OffsetArrays
1321
end
1422
end
1523

1624
@testset "activate test/Project" begin
1725
orig_project_toml_path = Base.active_project()
26+
push!(LOAD_PATH, mktempdir()) # put something weird in LOAD_PATH for testing
27+
orig_load_path = Base.LOAD_PATH
1828
try
1929
# YAXArrays has a test/Project.toml, which contains CSV
2030
TestEnv.activate("YAXArrays")
2131
new_project_toml_path = Base.active_project()
2232
@test new_project_toml_path != orig_project_toml_path
33+
@test orig_load_path == Base.LOAD_PATH
2334

2435
@eval using CSV
2536
@test isdefined(@__MODULE__, :CSV)
37+
2638
finally
2739
Pkg.activate(orig_project_toml_path)
2840
end
2941
end
30-
end
42+
end

0 commit comments

Comments
 (0)