Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New manifest format: Fix upgrade_manifest and raw dict entry for nothing #2610

Merged
merged 8 commits into from
Jun 9, 2021
2 changes: 1 addition & 1 deletion src/manifest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function validate_manifest(julia_version::Union{Nothing,VersionNumber}, manifest
end

function Manifest(raw::Dict, f_or_io::Union{String, IO})::Manifest
julia_version = isnothing(raw["julia_version"]) ? nothing : VersionNumber(raw["julia_version"])
julia_version = (raw["julia_version"] == "nothing") ? nothing : VersionNumber(raw["julia_version"])
manifest_format = VersionNumber(raw["manifest_format"])
if !in(manifest_format.major, 1:2)
if f_or_io isa IO
Expand Down
29 changes: 29 additions & 0 deletions test/manifests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,35 @@ using ..Utils
@test_logs (:warn,) Pkg.activate(env_dir; io=io)
end
end

@testset "Pkg.upgrade_manifest()" begin
env_dir = joinpath(@__DIR__, "manifest", "formats", "v1.0")
env_manifest = joinpath(env_dir, "Manifest.toml")
cp(env_manifest, string(env_manifest, "_backup"))
try
isfile(env_manifest) || error("Reference manifest is missing")
if Base.is_v1_format_manifest(Base.parsed_toml(env_manifest)) == false
error("Reference manifest file at $(env_manifest) is invalid")
end
isolate(loaded_depot=true) do
io = IOBuffer()
Pkg.activate(env_dir; io=io)
output = String(take!(io))
@test occursin(r"Activating.*project at.*`.*v1.0`", output)
@test Base.is_v1_format_manifest(Base.parsed_toml(env_manifest))

Pkg.upgrade_manifest()
@test Base.is_v1_format_manifest(Base.parsed_toml(env_manifest)) == false
Pkg.activate(env_dir; io=io)
output = String(take!(io))
@test occursin(r"Activating.*project at.*`.*v1.0`", output)
@test Pkg.Types.Context().env.manifest.manifest_format == v"2.0.0"
end
finally
cp(string(env_manifest, "_backup"), env_manifest, force = true)
rm(string(env_manifest, "_backup"))
end
end
end


Expand Down