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

Fix URL tests #2

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading