Skip to content

Commit

Permalink
Merge pull request #170 from sethaxen/fixci
Browse files Browse the repository at this point in the history
Fix CI
  • Loading branch information
oxinabox authored Jan 18, 2024
2 parents 86c84df + e00fcb9 commit 7442b8a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
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

0 comments on commit 7442b8a

Please sign in to comment.