Skip to content

Commit

Permalink
test fixes because Example v0.5.4 and v0.5.5 were registered (#4029)
Browse files Browse the repository at this point in the history
(cherry picked from commit 51d4910)
  • Loading branch information
IanButterworth authored and KristofferC committed Sep 30, 2024
1 parent 6993828 commit a1904c1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/new.jl
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ end
@test Pkg.dependencies()[exuuid].version == v"0.3.0"
@test Pkg.dependencies()[pngjll_uuid].version == v"1.6.37+4"
Pkg.add(Pkg.PackageSpec(;name="JSON", version="0.18.0"); preserve=Pkg.PRESERVE_NONE)
@test Pkg.dependencies()[exuuid].version == v"0.5.3"
@test Pkg.dependencies()[exuuid].version > v"0.3.0"
@test Pkg.dependencies()[json_uuid].version == v"0.18.0"
@test Pkg.dependencies()[pngjll_uuid].version > v"1.6.37+4"
end
Expand Down
21 changes: 19 additions & 2 deletions test/pkg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,9 @@ temp_pkg_dir() do project_path
end

@testset "develop / freeing" begin
Pkg.add(TEST_PKG.name)
Pkg.add(name=TEST_PKG.name, version=v"0.5.3")
old_v = Pkg.dependencies()[TEST_PKG.uuid].version
@test old_v == v"0.5.3"
Pkg.rm(TEST_PKG.name)
mktempdir() do devdir
withenv("JULIA_PKG_DEVDIR" => devdir) do
Expand Down Expand Up @@ -299,11 +300,27 @@ temp_pkg_dir() do project_path
touch("deps.jl")
"""
)
exa_proj = joinpath(devdir, TEST_PKG.name, "Project.toml")
proj_str = read(exa_proj, String)
compat_onwards = split(proj_str, "[compat]")[2]
open(exa_proj, "w") do io
println(io, """
name = "Example"
uuid = "$(TEST_PKG.uuid)"
version = "100.0.0"
[compat]
$compat_onwards
""")
end
Pkg.resolve()
@test Pkg.dependencies()[TEST_PKG.uuid].version == v"100.0.0"
Pkg.build(TEST_PKG.name)
@test isfile(joinpath(devdir, TEST_PKG.name, "deps", "deps.jl"))
Pkg.test(TEST_PKG.name)
Pkg.free(TEST_PKG.name)
@test Pkg.dependencies()[TEST_PKG.uuid].version == old_v
@test Pkg.dependencies()[TEST_PKG.uuid].version < v"100.0.0"
@test Pkg.dependencies()[TEST_PKG.uuid].version >= old_v
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion test/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ temp_pkg_dir(;rm=false) do project_path; cd(project_path) do;
tmp_pkg_path = mktempdir()

pkg"activate ."
pkg"add [email protected]"
pkg"add [email protected].3"
@test isinstalled(TEST_PKG)
v = Pkg.dependencies()[TEST_PKG.uuid].version
@test v == v"0.5.3"
pkg"rm Example"
pkg"add Example, Random"
pkg"rm Example Random"
Expand Down

0 comments on commit a1904c1

Please sign in to comment.