Skip to content
Closed
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
Manifest.toml
*.log
docs/build

# Fixture for the TestEnv merge-project guard: the test manifest is the point of the test.
!testdata/TestManifestPackage/test/Manifest.toml
3 changes: 2 additions & 1 deletion packages/TestEnv/src/julia-1.4/activate_set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ function activate(pkg::AbstractString=current_pkg_name())
if entry !== nothing && isfixed(entry)
subgraph = Pkg.Operations.prune_manifest(sandbox_manifest, [uuid])
for (uuid, entry) in subgraph
if haskey(working_manifest, uuid)
entry_working = get(working_manifest, uuid, nothing)
if entry_working !== nothing && entry_working != entry && (ctx.env.pkg !== nothing && ctx.env.pkg.uuid != uuid)
Pkg.Operations.pkgerror("can not merge projects")
end
working_manifest[uuid] = entry
Expand Down
3 changes: 2 additions & 1 deletion packages/TestEnv/src/julia-1.7/activate_set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ function activate(pkg::AbstractString=current_pkg_name())
if entry !== nothing && isfixed(entry)
subgraph = Pkg.Operations.prune_manifest(sandbox_manifest, [uuid])
for (uuid, entry) in subgraph
if haskey(working_manifest, uuid)
entry_working = get(working_manifest, uuid, nothing)
if entry_working !== nothing && entry_working != entry && (ctx.env.pkg !== nothing && ctx.env.pkg.uuid != uuid)
Pkg.Operations.pkgerror("can not merge projects")
end
working_manifest[uuid] = entry
Expand Down
3 changes: 2 additions & 1 deletion packages/TestEnv/src/julia-1.8/activate_set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ function activate(pkg::AbstractString=current_pkg_name(); allow_reresolve=true)
if entry !== nothing && isfixed(entry)
subgraph = Pkg.Operations.prune_manifest(sandbox_manifest, [uuid])
for (uuid, entry) in subgraph
if haskey(working_manifest, uuid)
entry_working = get(working_manifest, uuid, nothing)
if entry_working !== nothing && entry_working != entry && (ctx.env.pkg !== nothing && ctx.env.pkg.uuid != uuid)
Pkg.Operations.pkgerror("can not merge projects")
end
working_manifest[uuid] = entry
Expand Down
3 changes: 2 additions & 1 deletion packages/TestEnv/src/julia-1.9/activate_set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ function activate(pkg::AbstractString=current_pkg_name(); allow_reresolve=true)
if entry !== nothing && isfixed(entry)
subgraph = Pkg.Operations.prune_manifest(sandbox_manifest, [uuid])
for (uuid, entry) in subgraph
if haskey(working_manifest, uuid)
entry_working = get(working_manifest, uuid, nothing)
if entry_working !== nothing && entry_working != entry && (ctx.env.pkg !== nothing && ctx.env.pkg.uuid != uuid)
Pkg.Operations.pkgerror("can not merge projects")
end
working_manifest[uuid] = entry
Expand Down
51 changes: 51 additions & 0 deletions test/test_test_manifest.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Regression test for a package whose `test/Manifest.toml` lists the package itself as a
# `path = ".."` dev entry (the layout `Pkg.develop(path=".")` inside `test/` produces).
#
# TestEnv merges the test manifest into the package's own manifest and used to error with
# "can not merge projects" on Julia <= 1.10 when the package's uuid was already present, see
# julia-vscode/julia-vscode#3832 and #3633. The Julia 1.11+ variant of the vendored TestEnv
# already tolerated that; the older variants carry the same guard now.

@testitem "Package with test/Manifest.toml dev-ing itself activates" setup=[TestHelpers] begin
pkg_path = joinpath(TestHelpers.TESTDATA_DIR, "TestManifestPackage")
discovered = TestHelpers.discover_test_items(pkg_path)
@test length(discovered.items) == 1

result = TestHelpers.run_testrun(discovered)

passed_events = filter(e -> e.event == :passed, result.events)
errored_events = filter(e -> e.event == :errored, result.events)
failed_events = filter(e -> e.event == :failed, result.events)

@test length(passed_events) == 1
@test length(errored_events) == 0
@test length(failed_events) == 0
end

# Same fixture on Julia 1.10, the newest release that runs the pre-1.11 TestEnv variant
# where the guard was missing.
@testitem "Package with test/Manifest.toml dev-ing itself activates on Julia 1.10" tags=[:comprehensive_platform] setup=[TestHelpers] begin
version = "1.10"
version in TestHelpers.installed_juliaup_channels() ||
error("Julia $version is not installed. Install it with: juliaup add $version")

pkg_path = joinpath(TestHelpers.TESTDATA_DIR, "TestManifestPackage")
discovered = TestHelpers.discover_test_items(pkg_path)
@test length(discovered.items) == 1

result = TestHelpers.run_testrun(
discovered;
julia_cmd="julia",
julia_args=["+$version"],
timeout=1800,
env=TestHelpers.isolated_depot_env(version)
)

passed_events = filter(e -> e.event == :passed, result.events)
errored_events = filter(e -> e.event == :errored, result.events)
failed_events = filter(e -> e.event == :failed, result.events)

@test length(passed_events) == 1
@test length(errored_events) == 0
@test length(failed_events) == 0
end
3 changes: 3 additions & 0 deletions testdata/TestManifestPackage/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name = "TestManifestPackage"
uuid = "a1b2c3d4-0001-0002-0003-000000000005"
version = "0.1.0"
7 changes: 7 additions & 0 deletions testdata/TestManifestPackage/src/TestManifestPackage.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module TestManifestPackage

export add

add(a, b) = a + b

end
44 changes: 44 additions & 0 deletions testdata/TestManifestPackage/test/Manifest.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions testdata/TestManifestPackage/test/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[deps]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe"
TestManifestPackage = "a1b2c3d4-0001-0002-0003-000000000005"
4 changes: 4 additions & 0 deletions testdata/TestManifestPackage/test/testitems.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@testitem "add works" begin
using TestManifestPackage
@test add(1, 2) == 3
end
Loading