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

Registry consistency tests: For every version, check that each (weak)compat entry has a corresponding (weak)deps entry #525

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
40 changes: 40 additions & 0 deletions src/registry_testing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,46 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[])
else
@debug "Compat.toml file does not exist" compatfile
end

# https://github.com/JuliaRegistries/RegistryCI.jl/issues/522
# For every version, each compat entry has a corresponding deps entry.
#
# Note: it is legal for a package to have Compat.toml but not have
# Deps.toml. Specifically, this is legal if (and only if) the package
# does not have any dependencies, and does have a compat entry for `julia`.
Comment on lines +245 to +247
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't WeakDeps.toml be part of this reasoning too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we should do the same thing for WeakDeps/WeakCompat.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. We now do this for both Deps/Compat and also for WeakDeps/WeakCompat.

For Deps/Compat, it is legal for Compat.toml to exist but Deps.toml to not exist - specifically, if a package has no dependencies, and it has a compat entry for julia, then it will have Compat.toml but not Deps.toml.

However, if I understand correctly, it is never legal for a package to have Compat.toml but not have Deps.toml.

for weak in ["", "Weak"]
compatfile = abspath(data["path"], "$(weak)Compat.toml")
depsfile = abspath(data["path"], "$(weak)Deps.toml")
if isfile(compatfile)
if weak == "Weak"
# It is NOT legal for a package to have WeakCompat.toml but not have
# WeakDeps.toml
Test.@test isfile(depsfile)
end
compat_uncompressed = RegistryTools.Compress.load(compatfile)
deps_uncompressed = isfile(depsfile) ? RegistryTools.Compress.load(depsfile) : Dict()
for v in keys(vers)
compat_for_this_v = get(compat_uncompressed, v, Dict())
deps_for_this_v = get(deps_uncompressed, v, Dict())
Test.@test compat_for_this_v isa AbstractDict
Test.@test deps_for_this_v isa AbstractDict
for compat_pkgname in keys(compat_for_this_v)
if weak == "Weak"
# It is legal to have `julia` in Compat.toml.
# It is NOT legal to have `julia` in WeakCompat.toml
Test.@test compat_pkgname != "julia"
end
# If the package has a compat entry for `julia`, there
# is no need to have `julia` listed in Deps.toml.
# However, every other (weak)compat entry needs to be listed
# in (Weak)Deps.toml.
if compat_pkgname != "julia"
Test.@test haskey(deps_for_this_v, compat_pkgname)
end
end
end
end
end
end
# Make sure all paths are unique
path_parts = [splitpath(data["path"]) for (_, data) in reg["packages"]]
Expand Down
Loading