Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "TestEnv"
uuid = "1e6cf692-eddd-4d53-88a5-2d735e33781b"
version = "1.102.2"
version = "1.102.3"

[deps]
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Expand Down
3 changes: 2 additions & 1 deletion src/julia-1.11/activate_set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ function activate(pkg::AbstractString=current_pkg_name(); allow_reresolve=true)
for source in values(temp_ctx.env.project.sources)
isa(source, Dict) || continue
haskey(source, "path") || continue
base_path = test_dir_has_project_file(temp_ctx, pkgspec) ? joinpath(pkgspec.path, "test") : pkgspec.path
if !isabspath(source["path"])
source["path"] = joinpath(pkgspec.path, source["path"])
source["path"] = joinpath(base_path, source["path"])
end
end

Expand Down
17 changes: 17 additions & 0 deletions test/activate_set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,22 @@
Pkg.activate(orig_project_toml_path)
end
end
@testset "activate with [sources] and two Project.toml approach" begin
orig_project_toml_path = Base.active_project()
push!(LOAD_PATH, mktempdir()) # put something weird in LOAD_PATH for testing
orig_load_path = Base.LOAD_PATH
try
Pkg.activate(joinpath(@__DIR__, "sources", "MainTestProjectEnv"))
TestEnv.activate()
new_project_toml_path = Base.active_project()
@test new_project_toml_path != orig_project_toml_path
@test orig_load_path == Base.LOAD_PATH
@eval using MainTestProjectEnv
@test isdefined(@__MODULE__, :MainTestProjectEnv)
@test MainTestProjectEnv.bar() == 42
finally
Pkg.activate(orig_project_toml_path)
end
end
end
end
9 changes: 9 additions & 0 deletions test/sources/MainTestProjectEnv/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name = "MainTestProjectEnv"
uuid = "e316c70a-63ba-4d10-8c0b-cec00dfd6f7f"
version = "0.0.0"

[deps]
DependentEnv = "c9261501-a1a4-4a21-a37c-0c7025a0fef8"

[sources]
DependentEnv = {path = "../DependentEnv"}
6 changes: 6 additions & 0 deletions test/sources/MainTestProjectEnv/src/MainTestProjectEnv.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module MainTestProjectEnv
using DependentEnv

bar() = DependentEnv.foo() + 2 # Same as in MainEnv

end
8 changes: 8 additions & 0 deletions test/sources/MainTestProjectEnv/test/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[deps]
MainEnv = "1b324c26-e66a-4bf4-9aeb-d8ecf06e8e93"
MainTestProjectEnv = "e316c70a-63ba-4d10-8c0b-cec00dfd6f7f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[sources]
MainTestProjectEnv = {path = ".."}
MainEnv = {path = "../../MainEnv"}
5 changes: 5 additions & 0 deletions test/sources/MainTestProjectEnv/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using MainTestProjectEnv
using MainEnv
using Test

@test MainTestProjectEnv.bar() == MainEnv.foo()
Loading