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 CI #170

Merged
merged 3 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 1 addition & 3 deletions test/examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ using Test
using DataDeps
using DelimitedFiles

ENV["DATADEPS_ALWAYS_ACCEPT"] = true

@testset "Pi" begin
register(DataDep(
"Pi",
Expand Down Expand Up @@ -31,7 +29,7 @@ end

Used under Creative Commons Attribution 4.0 International License.
""",
"https://raw.githack.com/fivethirtyeight/data/master/trump-twitter/realDonaldTrump_poll_tweets.csv",
"https://rawcdn.githack.com/fivethirtyeight/data/f8c2c4beab87e21fe05d5559d0db2a1051c28abe/trump-twitter/realDonaldTrump_poll_tweets.csv",
"5a63b6cb2503a20517b5d41bd73e821ffbfdddd5cdc1977a547f1c925790bb15",
post_fetch_method = function(in_fn) # Multiline anon function.
out_fn = "nonmentions_"*basename(in_fn)
Expand Down
6 changes: 3 additions & 3 deletions test/fetch_helpers.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using Test
using DataDeps: fetch_default, fetch_base, fetch_http

ENV["DATADEPS_ALWAYS_ACCEPT"] = true

@testset "easy https url" begin
url = "https://www.angio.net/pi/digits/10000.txt"
# This is easy because the filename is in the URL
# So it works with both `fetch_base` and `fetch_http`
# HTTP.jl has tests for much more difficult cases, and fetch_http supports those
@testset "$fetch_func" for fetch_func in (fetch_default, fetch_base, fetch_http)
mktempdir() do localdir
localpath = fetch_func(url, localdir)
localpath = withenv("DATADEPS_ALWAYS_ACCEPT" => true) do
fetch_func(url, localdir)
end
@test isfile(localpath)
@test localpath == joinpath(localdir, "10000.txt")
@test stat(localpath).size == 10_001
Expand Down
6 changes: 4 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ using Test

@testset "examples" for fn in examples
@testset "$fn" begin
curdir = pwd()
tempdir = mktempdir()
try
@info("sending all datadeps to $tempdir")
withenv("DATADEPS_LOAD_PATH"=>tempdir,
"DATADEPS_NO_STANDARD_LOADPATH"=>true) do
"DATADEPS_NO_STANDARD_LOADPATH"=>true,
"DATADEPS_ALWAYS_ACCEPT" => true) do
@testset "download and use" begin
include(fn)
end
Expand All @@ -42,7 +44,7 @@ using Test
finally
try
@info("removing $tempdir")
cd(@__DIR__) # Ensure not currently in directory being deleted
cd(curdir) # Ensure not currently in directory being deleted
rm(tempdir, recursive=true, force=true)
catch err
@warn("Something went wrong with removing $tempdir")
Expand Down
Loading