Skip to content

Commit

Permalink
Merge #462
Browse files Browse the repository at this point in the history
462: Test suite: whenever we set a temp `JULIA_DEPOT_PATH`, we should also unset `JULIA_PROJECT` and `JULIA_LOAD_PATH` r=DilumAluthge a=DilumAluthge



Co-authored-by: Dilum Aluthge <[email protected]>
  • Loading branch information
bors[bot] and DilumAluthge committed Aug 14, 2022
2 parents ceddfce + 3ab7349 commit 85dd2f8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "RegistryCI"
uuid = "0c95cc5f-2f7e-43fe-82dd-79dbcba86b32"
authors = ["Dilum Aluthge <[email protected]>", "Fredrik Ekre <[email protected]>", "contributors"]
version = "7.5.0"
version = "7.5.1"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
22 changes: 12 additions & 10 deletions test/automerge-unit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -514,18 +514,20 @@ end
@testset "`AutoMerge.meets_version_has_osi_license`" begin
# Let's install a fresh depot in a temporary directory
# and add some packages to inspect.
tmp_path = mktempdir()
tmp_depot = mktempdir()
function has_osi_license_in_depot(pkg)
return AutoMerge.meets_version_has_osi_license(
pkg; pkg_code_path=pkgdir_from_depot(tmp_path, pkg)
pkg; pkg_code_path=pkgdir_from_depot(tmp_depot, pkg)
)
end
withenv("JULIA_DEPOT_PATH" => tmp_path, "JULIA_PKG_SERVER" => "") do
run(`julia -e 'import Pkg; Pkg.Registry.add("General")'`)
end
withenv("JULIA_DEPOT_PATH" => tmp_path) do
run(`julia -e 'import Pkg; Pkg.add(["RegistryCI"])'`)
end
env1 = copy(ENV)
env1["JULIA_DEPOT_PATH"] = tmp_depot
delete!(env1, "JULIA_LOAD_PATH")
delete!(env1, "JULIA_PROJECT")
env2 = copy(env1)
env2["JULIA_PKG_SERVER"] = ""
run(setenv(`julia -e 'import Pkg; Pkg.Registry.add("General")'`, env2))
run(setenv(`julia -e 'import Pkg; Pkg.add(["RegistryCI"])'`, env1))
# Let's test ourselves and some of our dependencies that just have MIT licenses:
result = has_osi_license_in_depot("RegistryCI")
@test result[1]
Expand All @@ -535,7 +537,7 @@ end
@test result[1]

# Now, what happens if there's also a non-OSI license in another file?
pkg_path = pkgdir_from_depot(tmp_path, "UnbalancedOptimalTransport")
pkg_path = pkgdir_from_depot(tmp_depot, "UnbalancedOptimalTransport")
open(joinpath(pkg_path, "LICENSE2"); write=true) do io
cc0_bytes = read(joinpath(@__DIR__, "license_data", "CC0.txt"))
println(io)
Expand All @@ -550,7 +552,7 @@ end
@test !result[1]

# What about no license at all?
pkg_path = pkgdir_from_depot(tmp_path, "VisualStringDistances")
pkg_path = pkgdir_from_depot(tmp_depot, "VisualStringDistances")
rm(joinpath(pkg_path, "LICENSE"))
result = has_osi_license_in_depot("VisualStringDistances")
@test !result[1]
Expand Down

2 comments on commit 85dd2f8

@DilumAluthge
Copy link
Member

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/66217

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v7.5.1 -m "<description of version>" 85dd2f8d137262841760d2e91ff7cb1cba4637ff
git push origin v7.5.1

Please sign in to comment.