Skip to content

Commit 5d7092e

Browse files
authored
Try to fix a test
1 parent 6531a77 commit 5d7092e

File tree

1 file changed

+37
-35
lines changed

1 file changed

+37
-35
lines changed

test/automerge-unit.jl

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -601,41 +601,43 @@ end
601601
end
602602

603603
@testset "`AutoMerge.meets_version_has_osi_license`" begin
604-
# Let's install a fresh depot in a temporary directory
605-
# and add some packages to inspect.
606-
tmp_depot = setup_global_depot()
607-
function has_osi_license_in_depot(pkg)
608-
return AutoMerge.meets_version_has_osi_license(
609-
pkg; pkg_code_path=pkgdir_from_depot(tmp_depot, pkg)
610-
)
611-
end
612-
# Let's test ourselves and some of our dependencies that just have MIT licenses:
613-
result = has_osi_license_in_depot("RegistryCI")
614-
@test result[1]
615-
result = has_osi_license_in_depot("UnbalancedOptimalTransport")
616-
@test result[1]
617-
result = has_osi_license_in_depot("VisualStringDistances")
618-
@test result[1]
619-
620-
# Now, what happens if there's also a non-OSI license in another file?
621-
pkg_path = pkgdir_from_depot(tmp_depot, "UnbalancedOptimalTransport")
622-
open(joinpath(pkg_path, "LICENSE2"); write=true) do io
623-
cc0_bytes = read(joinpath(@__DIR__, "license_data", "CC0.txt"))
624-
println(io)
625-
write(io, cc0_bytes)
604+
withenv("JULIA_PKG_PRECOMPILE_AUTO" => "0") do
605+
# Let's install a fresh depot in a temporary directory
606+
# and add some packages to inspect.
607+
tmp_depot = setup_global_depot()
608+
function has_osi_license_in_depot(pkg)
609+
return AutoMerge.meets_version_has_osi_license(
610+
pkg; pkg_code_path=pkgdir_from_depot(tmp_depot, pkg)
611+
)
612+
end
613+
# Let's test ourselves and some of our dependencies that just have MIT licenses:
614+
result = has_osi_license_in_depot("RegistryCI")
615+
@test result[1]
616+
result = has_osi_license_in_depot("UnbalancedOptimalTransport")
617+
@test result[1]
618+
result = has_osi_license_in_depot("VisualStringDistances")
619+
@test result[1]
620+
621+
# Now, what happens if there's also a non-OSI license in another file?
622+
pkg_path = pkgdir_from_depot(tmp_depot, "UnbalancedOptimalTransport")
623+
open(joinpath(pkg_path, "LICENSE2"); write=true) do io
624+
cc0_bytes = read(joinpath(@__DIR__, "license_data", "CC0.txt"))
625+
println(io)
626+
write(io, cc0_bytes)
627+
end
628+
result = has_osi_license_in_depot("UnbalancedOptimalTransport")
629+
@test result[1]
630+
631+
# What if we also remove the original license, leaving only the CC0 license?
632+
rm(joinpath(pkg_path, "LICENSE"))
633+
result = has_osi_license_in_depot("UnbalancedOptimalTransport")
634+
@test !result[1]
635+
636+
# What about no license at all?
637+
pkg_path = pkgdir_from_depot(tmp_depot, "VisualStringDistances")
638+
rm(joinpath(pkg_path, "LICENSE"))
639+
result = has_osi_license_in_depot("VisualStringDistances")
640+
@test !result[1]
626641
end
627-
result = has_osi_license_in_depot("UnbalancedOptimalTransport")
628-
@test result[1]
629-
630-
# What if we also remove the original license, leaving only the CC0 license?
631-
rm(joinpath(pkg_path, "LICENSE"))
632-
result = has_osi_license_in_depot("UnbalancedOptimalTransport")
633-
@test !result[1]
634-
635-
# What about no license at all?
636-
pkg_path = pkgdir_from_depot(tmp_depot, "VisualStringDistances")
637-
rm(joinpath(pkg_path, "LICENSE"))
638-
result = has_osi_license_in_depot("VisualStringDistances")
639-
@test !result[1]
640642
end
641643
end

0 commit comments

Comments
 (0)