From e57f1edd10a75f0275cba1bd6db27f5436f7dd8b Mon Sep 17 00:00:00 2001 From: David Varela <00.varela.david@gmail.com> Date: Thu, 5 Dec 2019 19:27:05 -0800 Subject: [PATCH] more tests --- src/Operations.jl | 2 +- test/new.jl | 42 +++++++++++++++++ test/test_packages/A/A/Manifest.toml | 6 +++ test/test_packages/A/A/Project.toml | 2 + test/test_packages/A/Manifest.toml | 17 +++++++ test/test_packages/A/Project.toml | 7 +++ test/test_packages/A/dev/B/Project.toml | 3 ++ test/test_packages/A/dev/B/src/B.jl | 5 ++ test/test_packages/A/dev/C/Manifest.toml | 6 +++ test/test_packages/A/dev/C/Project.toml | 6 +++ test/test_packages/A/dev/C/src/C.jl | 5 ++ test/test_packages/A/dev/D/Project.toml | 3 ++ test/test_packages/A/dev/D/src/D.jl | 5 ++ test/test_packages/A/src/A.jl | 5 ++ .../TestDepTrackingRepo/Project.toml | 3 ++ .../src/TestDepTrackingRepo.jl | 5 ++ .../TestDepTrackingRepo/test/Manifest.toml | 46 +++++++++++++++++++ .../TestDepTrackingRepo/test/Project.toml | 3 ++ .../TestDepTrackingRepo/test/runtests.jl | 7 +++ .../TestSubgraphTrackingRepo/Manifest.toml | 14 ++++++ .../TestSubgraphTrackingRepo/Project.toml | 6 +++ .../src/TestSubgraphTrackingRepo.jl | 5 ++ .../test/Manifest.toml | 33 +++++++++++++ .../test/Project.toml | 2 + .../TestSubgraphTrackingRepo/test/runtests.jl | 6 +++ 25 files changed, 243 insertions(+), 1 deletion(-) create mode 100644 test/test_packages/A/A/Manifest.toml create mode 100644 test/test_packages/A/A/Project.toml create mode 100644 test/test_packages/A/Manifest.toml create mode 100644 test/test_packages/A/Project.toml create mode 100644 test/test_packages/A/dev/B/Project.toml create mode 100644 test/test_packages/A/dev/B/src/B.jl create mode 100644 test/test_packages/A/dev/C/Manifest.toml create mode 100644 test/test_packages/A/dev/C/Project.toml create mode 100644 test/test_packages/A/dev/C/src/C.jl create mode 100644 test/test_packages/A/dev/D/Project.toml create mode 100644 test/test_packages/A/dev/D/src/D.jl create mode 100644 test/test_packages/A/src/A.jl create mode 100644 test/test_packages/TestDepTrackingRepo/Project.toml create mode 100644 test/test_packages/TestDepTrackingRepo/src/TestDepTrackingRepo.jl create mode 100644 test/test_packages/TestDepTrackingRepo/test/Manifest.toml create mode 100644 test/test_packages/TestDepTrackingRepo/test/Project.toml create mode 100644 test/test_packages/TestDepTrackingRepo/test/runtests.jl create mode 100644 test/test_packages/TestSubgraphTrackingRepo/Manifest.toml create mode 100644 test/test_packages/TestSubgraphTrackingRepo/Project.toml create mode 100644 test/test_packages/TestSubgraphTrackingRepo/src/TestSubgraphTrackingRepo.jl create mode 100644 test/test_packages/TestSubgraphTrackingRepo/test/Manifest.toml create mode 100644 test/test_packages/TestSubgraphTrackingRepo/test/Project.toml create mode 100644 test/test_packages/TestSubgraphTrackingRepo/test/runtests.jl diff --git a/src/Operations.jl b/src/Operations.jl index 6429b9e271..64eb782134 100644 --- a/src/Operations.jl +++ b/src/Operations.jl @@ -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 diff --git a/test/new.jl b/test/new.jl index c8c35f46db..f0b3559166 100644 --- a/test/new.jl +++ b/test/new.jl @@ -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") @@ -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") @@ -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) @@ -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 diff --git a/test/test_packages/A/A/Manifest.toml b/test/test_packages/A/A/Manifest.toml new file mode 100644 index 0000000000..f47e0c1ef3 --- /dev/null +++ b/test/test_packages/A/A/Manifest.toml @@ -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" diff --git a/test/test_packages/A/A/Project.toml b/test/test_packages/A/A/Project.toml new file mode 100644 index 0000000000..504bbd6caf --- /dev/null +++ b/test/test_packages/A/A/Project.toml @@ -0,0 +1,2 @@ +[deps] +B = "dd0d8fba-d7c4-4f8e-a2bb-3a090b3e34f1" diff --git a/test/test_packages/A/Manifest.toml b/test/test_packages/A/Manifest.toml new file mode 100644 index 0000000000..13ecf4d045 --- /dev/null +++ b/test/test_packages/A/Manifest.toml @@ -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" diff --git a/test/test_packages/A/Project.toml b/test/test_packages/A/Project.toml new file mode 100644 index 0000000000..10ccccdc1b --- /dev/null +++ b/test/test_packages/A/Project.toml @@ -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" diff --git a/test/test_packages/A/dev/B/Project.toml b/test/test_packages/A/dev/B/Project.toml new file mode 100644 index 0000000000..c879e65612 --- /dev/null +++ b/test/test_packages/A/dev/B/Project.toml @@ -0,0 +1,3 @@ +name = "B" +uuid = "dd0d8fba-d7c4-4f8e-a2bb-3a090b3e34f1" +version = "0.1.0" diff --git a/test/test_packages/A/dev/B/src/B.jl b/test/test_packages/A/dev/B/src/B.jl new file mode 100644 index 0000000000..c1e3f56285 --- /dev/null +++ b/test/test_packages/A/dev/B/src/B.jl @@ -0,0 +1,5 @@ +module B + +greet() = print("Hello World!") + +end # module diff --git a/test/test_packages/A/dev/C/Manifest.toml b/test/test_packages/A/dev/C/Manifest.toml new file mode 100644 index 0000000000..7ca01c3a9a --- /dev/null +++ b/test/test_packages/A/dev/C/Manifest.toml @@ -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" diff --git a/test/test_packages/A/dev/C/Project.toml b/test/test_packages/A/dev/C/Project.toml new file mode 100644 index 0000000000..5a0c1d5d07 --- /dev/null +++ b/test/test_packages/A/dev/C/Project.toml @@ -0,0 +1,6 @@ +name = "C" +uuid = "4ee78ca3-4e78-462f-a078-747ed543fa85" +version = "0.1.0" + +[deps] +D = "bf733257-898a-45a0-b2f2-c1c188bdd879" diff --git a/test/test_packages/A/dev/C/src/C.jl b/test/test_packages/A/dev/C/src/C.jl new file mode 100644 index 0000000000..b9df11cf32 --- /dev/null +++ b/test/test_packages/A/dev/C/src/C.jl @@ -0,0 +1,5 @@ +module C + +greet() = print("Hello World!") + +end # module diff --git a/test/test_packages/A/dev/D/Project.toml b/test/test_packages/A/dev/D/Project.toml new file mode 100644 index 0000000000..9655342f7b --- /dev/null +++ b/test/test_packages/A/dev/D/Project.toml @@ -0,0 +1,3 @@ +name = "D" +uuid = "bf733257-898a-45a0-b2f2-c1c188bdd879" +version = "0.1.0" diff --git a/test/test_packages/A/dev/D/src/D.jl b/test/test_packages/A/dev/D/src/D.jl new file mode 100644 index 0000000000..915cfc430a --- /dev/null +++ b/test/test_packages/A/dev/D/src/D.jl @@ -0,0 +1,5 @@ +module D + +greet() = print("Hello World!") + +end # module diff --git a/test/test_packages/A/src/A.jl b/test/test_packages/A/src/A.jl new file mode 100644 index 0000000000..f13b21e0d3 --- /dev/null +++ b/test/test_packages/A/src/A.jl @@ -0,0 +1,5 @@ +module A + +greet() = print("Hello World!") + +end # module diff --git a/test/test_packages/TestDepTrackingRepo/Project.toml b/test/test_packages/TestDepTrackingRepo/Project.toml new file mode 100644 index 0000000000..cf9294d1a1 --- /dev/null +++ b/test/test_packages/TestDepTrackingRepo/Project.toml @@ -0,0 +1,3 @@ +name = "TestDepTrackingRepo" +uuid = "1aa427b2-74ee-4d6b-bdb5-06afc43defa2" +version = "0.1.0" diff --git a/test/test_packages/TestDepTrackingRepo/src/TestDepTrackingRepo.jl b/test/test_packages/TestDepTrackingRepo/src/TestDepTrackingRepo.jl new file mode 100644 index 0000000000..4250439067 --- /dev/null +++ b/test/test_packages/TestDepTrackingRepo/src/TestDepTrackingRepo.jl @@ -0,0 +1,5 @@ +module TestDepTrackingRepo + +greet() = print("Hello World!") + +end # module diff --git a/test/test_packages/TestDepTrackingRepo/test/Manifest.toml b/test/test_packages/TestDepTrackingRepo/test/Manifest.toml new file mode 100644 index 0000000000..117065466e --- /dev/null +++ b/test/test_packages/TestDepTrackingRepo/test/Manifest.toml @@ -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" diff --git a/test/test_packages/TestDepTrackingRepo/test/Project.toml b/test/test_packages/TestDepTrackingRepo/test/Project.toml new file mode 100644 index 0000000000..c7525917a3 --- /dev/null +++ b/test/test_packages/TestDepTrackingRepo/test/Project.toml @@ -0,0 +1,3 @@ +[deps] +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +Unregistered = "dcb67f36-efa0-11e8-0cef-2fc465ed98ae" diff --git a/test/test_packages/TestDepTrackingRepo/test/runtests.jl b/test/test_packages/TestDepTrackingRepo/test/runtests.jl new file mode 100644 index 0000000000..7ba20d4824 --- /dev/null +++ b/test/test_packages/TestDepTrackingRepo/test/runtests.jl @@ -0,0 +1,7 @@ +module Runtests +using Unregistered +using Test + +@test true + +end diff --git a/test/test_packages/TestSubgraphTrackingRepo/Manifest.toml b/test/test_packages/TestSubgraphTrackingRepo/Manifest.toml new file mode 100644 index 0000000000..c817a7b266 --- /dev/null +++ b/test/test_packages/TestSubgraphTrackingRepo/Manifest.toml @@ -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" diff --git a/test/test_packages/TestSubgraphTrackingRepo/Project.toml b/test/test_packages/TestSubgraphTrackingRepo/Project.toml new file mode 100644 index 0000000000..56d00103b3 --- /dev/null +++ b/test/test_packages/TestSubgraphTrackingRepo/Project.toml @@ -0,0 +1,6 @@ +name = "TestSubgraphTrackingRepo" +uuid = "d3372e38-1633-4b7b-8908-744ad371df6e" +version = "0.1.0" + +[deps] +Unregistered = "dcb67f36-efa0-11e8-0cef-2fc465ed98ae" diff --git a/test/test_packages/TestSubgraphTrackingRepo/src/TestSubgraphTrackingRepo.jl b/test/test_packages/TestSubgraphTrackingRepo/src/TestSubgraphTrackingRepo.jl new file mode 100644 index 0000000000..316d86379d --- /dev/null +++ b/test/test_packages/TestSubgraphTrackingRepo/src/TestSubgraphTrackingRepo.jl @@ -0,0 +1,5 @@ +module TestSubgraphTrackingRepo + +greet() = print("Hello World!") + +end # module diff --git a/test/test_packages/TestSubgraphTrackingRepo/test/Manifest.toml b/test/test_packages/TestSubgraphTrackingRepo/test/Manifest.toml new file mode 100644 index 0000000000..ac58105fd6 --- /dev/null +++ b/test/test_packages/TestSubgraphTrackingRepo/test/Manifest.toml @@ -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" diff --git a/test/test_packages/TestSubgraphTrackingRepo/test/Project.toml b/test/test_packages/TestSubgraphTrackingRepo/test/Project.toml new file mode 100644 index 0000000000..0c363327cb --- /dev/null +++ b/test/test_packages/TestSubgraphTrackingRepo/test/Project.toml @@ -0,0 +1,2 @@ +[deps] +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/test/test_packages/TestSubgraphTrackingRepo/test/runtests.jl b/test/test_packages/TestSubgraphTrackingRepo/test/runtests.jl new file mode 100644 index 0000000000..af5626d502 --- /dev/null +++ b/test/test_packages/TestSubgraphTrackingRepo/test/runtests.jl @@ -0,0 +1,6 @@ +module Runtests +using Test + +@test true + +end