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
5 changes: 2 additions & 3 deletions test/extensions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ using UUIDs
isolate(loaded_depot=false) do
mktempdir() do dir
Pkg.Registry.add("General")
path = joinpath(@__DIR__, "test_packages", "TestWeakDepProject")
cp(path, joinpath(dir, "TestWeakDepProject"))
Pkg.activate(joinpath(dir, "TestWeakDepProject"))
path = copy_test_package(dir, "TestWeakDepProject")
Pkg.activate(path)
Pkg.resolve()
@test Pkg.dependencies()[UUID("2ab3a3ac-af41-5b50-aa03-7779005ae688")].version == v"0.3.26"

Expand Down
10 changes: 4 additions & 6 deletions test/new.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3224,9 +3224,8 @@ end
temp_pkg_dir() do project_path
@testset "test entryfile entries" begin
mktempdir() do dir
path = abspath(joinpath(dirname(pathof(Pkg)), "../test", "test_packages", "ProjectPath"))
cp(path, joinpath(dir, "ProjectPath"))
cd(joinpath(dir, "ProjectPath")) do
path = copy_test_package(dir, "ProjectPath")
cd(path) do
with_current_env() do
Pkg.resolve()
@test success(run(`$(Base.julia_cmd()) --startup-file=no --project -e 'using ProjectPath'`))
Expand All @@ -3238,9 +3237,8 @@ temp_pkg_dir() do project_path
end
@testset "test resolve with tree hash" begin
mktempdir() do dir
path = abspath(joinpath(@__DIR__, "../test", "test_packages", "ResolveWithRev"))
cp(path, joinpath(dir, "ResolveWithRev"))
cd(joinpath(dir, "ResolveWithRev")) do
path = copy_test_package(dir, "ResolveWithRev")
cd(path) do
with_current_env() do
@test !isfile("Manifest.toml")
@test !isdir(joinpath(DEPOT_PATH[1], "packages", "Example"))
Expand Down
7 changes: 3 additions & 4 deletions test/project_manifest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ using ..Utils
temp_pkg_dir() do project_path
@testset "test Project.toml manifest" begin
mktempdir() do dir
path = abspath(joinpath(dirname(pathof(Pkg)), "../test", "test_packages", "monorepo"))
cp(path, joinpath(dir, "monorepo"))
cd(joinpath(dir, "monorepo")) do
path = copy_test_package(dir, "monorepo")
cd(path) do
with_current_env() do
Pkg.develop(path="packages/B")
end
Expand Down Expand Up @@ -60,4 +59,4 @@ temp_pkg_dir() do project_path
end
end

end # module
end # module
5 changes: 2 additions & 3 deletions test/sources.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ using ..Utils
temp_pkg_dir() do project_path
@testset "test Project.toml [sources]" begin
mktempdir() do dir
path = abspath(joinpath(dirname(pathof(Pkg)), "../test", "test_packages", "WithSources"))
cp(path, joinpath(dir, "WithSources"))
cd(joinpath(dir, "WithSources")) do
path = copy_test_package(dir, "WithSources")
cd(path) do
with_current_env() do
Pkg.resolve()
@test !isempty(Pkg.project().sources["Example"])
Expand Down
12 changes: 12 additions & 0 deletions test/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,21 @@ function git_init_package(tmp, path)
return pkgpath
end

function ensure_test_package_user_writable(dir)
for (root, _, files) in walkdir(dir)
chmod(root, filemode(root) | 0o200 | 0o100)

for file in files
filepath = joinpath(root, file)
chmod(filepath, filemode(filepath) | 0o200)
end
end
end

function copy_test_package(tmpdir::String, name::String; use_pkg=true)
target = joinpath(tmpdir, name)
cp(joinpath(@__DIR__, "test_packages", name), target)
ensure_test_package_user_writable(target)
use_pkg || return target

# The known Pkg UUID, and whatever UUID we're currently using for testing
Expand Down
5 changes: 2 additions & 3 deletions test/workspaces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,8 @@ end

@testset "test resolve with tree hash" begin
mktempdir() do dir
path = abspath(joinpath(@__DIR__, "../test", "test_packages", "WorkspaceTestInstantiate"))
cp(path, joinpath(dir, "WorkspaceTestInstantiate"))
cd(joinpath(dir, "WorkspaceTestInstantiate")) do
path = copy_test_package(dir, "WorkspaceTestInstantiate")
cd(path) do
with_current_env() do
@test !isfile("Manifest.toml")
@test !isfile("test/Manifest.toml")
Expand Down
Loading