Skip to content

Commit

Permalink
Fix URL tests (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrhill authored Oct 22, 2024
1 parent ade23ba commit b0ddba4
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ using Arxiv: @arXiv_str # hosted on GitLab
using GPMaxlik: gnll # hosted on sourcehut

function url_exists(url)
url = replace(url, r"#.*$" => "") # strip line number
response = request("GET", url; status_exception=false, redirect=true, retry=true)
if 200 response.status < 400
return true
Expand Down Expand Up @@ -75,51 +76,53 @@ end
@testset "Base" begin
m = @which sqrt(0.0)
u = first(@inferred url(m))
# @test url_exists(u)
@test url_exists(u)
end
@testset "Stdlib" begin
@testset "within julialang/julia" begin
m = @which @test true
u = first(@inferred url(m))
# @test url_exists(u)
@test url_exists(u)

m = @which det(rand(2, 2))
u = first(@inferred url(m))
# @test url_exists(u)
@test url_exists(u)
end
@testset "own repository" begin
@testset "standalone repository" begin
m = @which mean(rand(5))
u = first(@inferred url(m))
# @test url_exists(u)
if VERSION >= v"1.11" # no tag for Statistics.jl v1.10.0
@test url_exists(u)
end
end
end

@testset "External" begin
@testset "GitHub" begin
m = @which Aqua.test_all(MethodURL)
u = first(@inferred url(m))
# @test url_exists(u)
end
@testset "GitHub monorepo" begin
m = first(methods(Plots.RecipesBase.create_kw_body))
u = first(@inferred url(m))
# @test url_exists(u)
@test url_exists(u)
end
# @testset "GitHub monorepo" begin
# m = first(methods(Plots.RecipesBase.create_kw_body))
# u = first(@inferred url(m))
# @test url_exists(u)
# end
@testset "GitLab" begin
m = @which arXiv"1234.5678"
u = first(@inferred url(m))
# @test url_exists(u) # no tags in Arxiv.jl
@test_broken url_exists(u) # no tags in Arxiv.jl
end
@testset "Sourcehut" begin
m = first(methods(gnll))
u = first(@inferred url(m))
# @test url_exists(u) # no tags in GPMaxlik.jl
@test_broken url_exists(u) # no tags in GPMaxlik.jl
end
end
# @testset "Local" begin
# m = @which url(@which sqrt(1.0))
# u = first(@inferred url(m))
# # @test url_exists(u)
# @test_broken url_exists(u)
# end
end
end

0 comments on commit b0ddba4

Please sign in to comment.