Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
00vareladavid committed Dec 6, 2019
1 parent 2451663 commit e57f1ed
Show file tree
Hide file tree
Showing 25 changed files with 243 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ function collect_developed!(ctx::Context, pkg::PackageSpec, developed::Vector{Pa
pkgs = load_all_deps(source_ctx)
for pkg in filter(is_tracking_path, pkgs)
# normalize path
pkg.path = project_rel_path(source_ctx, source_path(pkg))
pkg.path = Types.relative_project_path(ctx, project_rel_path(source_ctx, source_path(pkg)))
push!(developed, pkg)
collect_developed!(ctx, pkg, developed)
end
Expand Down
42 changes: 42 additions & 0 deletions test/new.jl
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,17 @@ inside_test_sandbox(fn; kwargs...) = Pkg.test(;test_fn=fn, kwargs...)
@test deps[exuuid].isdeveloped
end
end end
# the active dep graph is transfered to test sandbox, even when tracking unregistered repos
isolate(loaded_depot=true) do; mktempdir() do tempdir
path = copy_test_package(tempdir, "TestSubgraphTrackingRepo")
Pkg.activate(path)
inside_test_sandbox() do
Pkg.dependencies(unregistered_uuid) do pkg
@test pkg.git_source == "https://github.com/00vareladavid/Unregistered.jl"
@test !pkg.is_tracking_registry
end
end
end end
# a test dependency can track a path
isolate(loaded_depot=true) do; mktempdir() do tempdir
path = copy_test_package(tempdir, "TestDepTrackingPath")
Expand All @@ -181,6 +192,17 @@ inside_test_sandbox(fn; kwargs...) = Pkg.test(;test_fn=fn, kwargs...)
@test Pkg.dependencies()[unregistered_uuid].isdeveloped
end
end end
# a test dependency can track a repo
isolate(loaded_depot=true) do; mktempdir() do tempdir
path = copy_test_package(tempdir, "TestDepTrackingRepo")
Pkg.activate(path)
inside_test_sandbox() do
Pkg.dependencies(unregistered_uuid) do pkg
@test !pkg.is_tracking_registry
@test pkg.git_source == "https://github.com/00vareladavid/Unregistered.jl"
end
end
end end
# `compat` for test dependencies is honored
isolate(loaded_depot=true) do; mktempdir() do tempdir
path = copy_test_package(tempdir, "TestDepCompat")
Expand Down Expand Up @@ -228,6 +250,7 @@ end
@test deps[UUID("c86f0f68-174e-41db-bd5e-b032223de205")].version == v"1.2.3"
end
end end
# test targets should also honor compat
isolate(loaded_depot=false) do; mktempdir() do tempdir
path = copy_test_package(tempdir, "TestTargetCompat")
Pkg.activate(path)
Expand Down Expand Up @@ -823,6 +846,25 @@ end
end
@test haskey(Pkg.project().dependencies, "SimplePackage")
end end
# recursive `dev`
isolate(loaded_depot=true) do
Pkg.develop(Pkg.PackageSpec(;path=joinpath(@__DIR__, "test_packages", "A")))
Pkg.dependencies(UUID("0829fd7c-1e7e-4927-9afa-b8c61d5e0e42")) do pkg # dep A
@test haskey(pkg.dependencies, "B")
@test haskey(pkg.dependencies, "C")
@test pkg.source == joinpath(@__DIR__, "test_packages", "A")
end
Pkg.dependencies(UUID("4ee78ca3-4e78-462f-a078-747ed543fa85")) do pkg # dep C
@test haskey(pkg.dependencies, "D")
@test pkg.source == joinpath(@__DIR__, "test_packages", "A", "dev", "C")
end
Pkg.dependencies(UUID("dd0d8fba-d7c4-4f8e-a2bb-3a090b3e34f1")) do pkg # dep B
@test pkg.source == joinpath(@__DIR__, "test_packages", "A", "dev", "B")
end
Pkg.dependencies(UUID("bf733257-898a-45a0-b2f2-c1c188bdd879")) do pkg # dep D
@test pkg.source == joinpath(@__DIR__, "test_packages", "A", "dev", "D")
end
end
end

@testset "develop: interaction with `JULIA_PKG_DEVDIR`" begin
Expand Down
6 changes: 6 additions & 0 deletions test/test_packages/A/A/Manifest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This file is machine-generated - editing it directly is not advised

[[B]]
path = "../dev/B"
uuid = "dd0d8fba-d7c4-4f8e-a2bb-3a090b3e34f1"
version = "0.1.0"
2 changes: 2 additions & 0 deletions test/test_packages/A/A/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[deps]
B = "dd0d8fba-d7c4-4f8e-a2bb-3a090b3e34f1"
17 changes: 17 additions & 0 deletions test/test_packages/A/Manifest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file is machine-generated - editing it directly is not advised

[[B]]
path = "dev/B"
uuid = "dd0d8fba-d7c4-4f8e-a2bb-3a090b3e34f1"
version = "0.1.0"

[[C]]
deps = ["D"]
path = "dev/C"
uuid = "4ee78ca3-4e78-462f-a078-747ed543fa85"
version = "0.1.0"

[[D]]
path = "dev/D"
uuid = "bf733257-898a-45a0-b2f2-c1c188bdd879"
version = "0.1.0"
7 changes: 7 additions & 0 deletions test/test_packages/A/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name = "A"
uuid = "0829fd7c-1e7e-4927-9afa-b8c61d5e0e42"
version = "0.1.0"

[deps]
B = "dd0d8fba-d7c4-4f8e-a2bb-3a090b3e34f1"
C = "4ee78ca3-4e78-462f-a078-747ed543fa85"
3 changes: 3 additions & 0 deletions test/test_packages/A/dev/B/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name = "B"
uuid = "dd0d8fba-d7c4-4f8e-a2bb-3a090b3e34f1"
version = "0.1.0"
5 changes: 5 additions & 0 deletions test/test_packages/A/dev/B/src/B.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module B

greet() = print("Hello World!")

end # module
6 changes: 6 additions & 0 deletions test/test_packages/A/dev/C/Manifest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This file is machine-generated - editing it directly is not advised

[[D]]
path = "../D"
uuid = "bf733257-898a-45a0-b2f2-c1c188bdd879"
version = "0.1.0"
6 changes: 6 additions & 0 deletions test/test_packages/A/dev/C/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name = "C"
uuid = "4ee78ca3-4e78-462f-a078-747ed543fa85"
version = "0.1.0"

[deps]
D = "bf733257-898a-45a0-b2f2-c1c188bdd879"
5 changes: 5 additions & 0 deletions test/test_packages/A/dev/C/src/C.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module C

greet() = print("Hello World!")

end # module
3 changes: 3 additions & 0 deletions test/test_packages/A/dev/D/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name = "D"
uuid = "bf733257-898a-45a0-b2f2-c1c188bdd879"
version = "0.1.0"
5 changes: 5 additions & 0 deletions test/test_packages/A/dev/D/src/D.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module D

greet() = print("Hello World!")

end # module
5 changes: 5 additions & 0 deletions test/test_packages/A/src/A.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module A

greet() = print("Hello World!")

end # module
3 changes: 3 additions & 0 deletions test/test_packages/TestDepTrackingRepo/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name = "TestDepTrackingRepo"
uuid = "1aa427b2-74ee-4d6b-bdb5-06afc43defa2"
version = "0.1.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module TestDepTrackingRepo

greet() = print("Hello World!")

end # module
46 changes: 46 additions & 0 deletions test/test_packages/TestDepTrackingRepo/test/Manifest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This file is machine-generated - editing it directly is not advised

[[Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[Distributed]]
deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[Example]]
git-tree-sha1 = "46e44e869b4d90b96bd8ed1fdcf32244fddfb6cc"
uuid = "7876af07-990d-54b4-ab0e-23690620f79a"
version = "0.5.3"

[[InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

[[Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"

[[Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"

[[Random]]
deps = ["Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[[Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"

[[Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"

[[Test]]
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[[Unregistered]]
deps = ["Example"]
git-tree-sha1 = "cca953732cd949cfe36d70e981a41ac32a5c6ae7"
repo-rev = "master"
repo-url = "https://github.com/00vareladavid/Unregistered.jl"
uuid = "dcb67f36-efa0-11e8-0cef-2fc465ed98ae"
version = "0.2.0"
3 changes: 3 additions & 0 deletions test/test_packages/TestDepTrackingRepo/test/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[deps]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Unregistered = "dcb67f36-efa0-11e8-0cef-2fc465ed98ae"
7 changes: 7 additions & 0 deletions test/test_packages/TestDepTrackingRepo/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module Runtests
using Unregistered
using Test

@test true

end
14 changes: 14 additions & 0 deletions test/test_packages/TestSubgraphTrackingRepo/Manifest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file is machine-generated - editing it directly is not advised

[[Example]]
git-tree-sha1 = "46e44e869b4d90b96bd8ed1fdcf32244fddfb6cc"
uuid = "7876af07-990d-54b4-ab0e-23690620f79a"
version = "0.5.3"

[[Unregistered]]
deps = ["Example"]
git-tree-sha1 = "cca953732cd949cfe36d70e981a41ac32a5c6ae7"
repo-rev = "master"
repo-url = "https://github.com/00vareladavid/Unregistered.jl"
uuid = "dcb67f36-efa0-11e8-0cef-2fc465ed98ae"
version = "0.2.0"
6 changes: 6 additions & 0 deletions test/test_packages/TestSubgraphTrackingRepo/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name = "TestSubgraphTrackingRepo"
uuid = "d3372e38-1633-4b7b-8908-744ad371df6e"
version = "0.1.0"

[deps]
Unregistered = "dcb67f36-efa0-11e8-0cef-2fc465ed98ae"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module TestSubgraphTrackingRepo

greet() = print("Hello World!")

end # module
33 changes: 33 additions & 0 deletions test/test_packages/TestSubgraphTrackingRepo/test/Manifest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This file is machine-generated - editing it directly is not advised

[[Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[Distributed]]
deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

[[Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"

[[Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"

[[Random]]
deps = ["Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[[Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"

[[Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"

[[Test]]
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2 changes: 2 additions & 0 deletions test/test_packages/TestSubgraphTrackingRepo/test/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[deps]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
6 changes: 6 additions & 0 deletions test/test_packages/TestSubgraphTrackingRepo/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module Runtests
using Test

@test true

end

0 comments on commit e57f1ed

Please sign in to comment.