Skip to content

Commit 3911151

Browse files
committed
Update tests
1 parent f2c0938 commit 3911151

File tree

5 files changed

+21
-5
lines changed

5 files changed

+21
-5
lines changed

src/axisarrays/axisindices.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using .AxisIndices: AbstractAxis,AxisIndices
1+
using .AxisIndices: AbstractAxis,AxisIndicesArray
22

33
valfromaxis(ax::AbstractAxis) = keys(ax)
44

src/datasets/netcdf.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function check_contig(x)
3535
end
3636
writeblock!(v::NetCDFVariable, aout, r::AbstractUnitRange...) = NetCDF.open(a->writeblock!(a,aout,r...), v.filename, v.varname, mode=NC_WRITE)
3737
function readblock!(v::NetCDFVariable, aout, r::AbstractUnitRange...)
38-
if check_contig
38+
if check_contig(aout)
3939
NetCDF.open(a->readblock!(a,aout,r...), v.filename, v.varname)
4040
else
4141
aouttemp = Array(aout)

test/Artifacts.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[ncar]
2+
git-tree-sha1 = "b3ad9125b25731444e8118c0a808aa2d3fc0eb1e"

test/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ DimensionalData = "0703355e-b756-11e9-17c0-8b28908087d0"
77
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
88
NamedDims = "356022a1-0364-5f58-8944-0da4b18d706f"
99
NetCDF = "30363a11-5582-574a-97bb-aa9a979735b9"
10+
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
1011
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1112
Zarr = "0a941bbe-ad1d-11e8-39d9-ab76183a1d99"

test/datasets.jl

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,24 @@ end
55

66
using NetCDF, Zarr
77

8-
@testset "Reading NetCDF" begin
8+
using Pkg.Artifacts
99
import Downloads
10-
p = Downloads.download("https://www.unidata.ucar.edu/software/netcdf/examples/sresa1b_ncar_ccsm3-example.nc")
10+
# This is the path to the Artifacts.toml we will manipulate
11+
artifact_toml = joinpath(@__DIR__,"Artifacts.toml")
12+
ncar_hash = artifact_hash("ncar", artifact_toml)
13+
if ncar_hash == nothing || !artifact_exists(ncar_hash)
14+
oldhash = ncar_hash
15+
ncar_hash = create_artifact() do artifact_dir
16+
Downloads.download("https://www.unidata.ucar.edu/software/netcdf/examples/sresa1b_ncar_ccsm3-example.nc",joinpath(artifact_dir,"ncar.nc"))
17+
end
18+
if oldhash !== nothing
19+
unbind_artifact!(artifact_toml, "ncar")
20+
end
21+
bind_artifact!(artifact_toml, "ncar", ncar_hash)
22+
end
23+
p2 = joinpath(artifact_path(ncar_hash),"ncar.nc")
1124

12-
p2 = mv(p,string(tempname(),".nc"))
25+
@testset "Reading NetCDF" begin
1326

1427
ds_nc = YAXArrayBase.to_dataset(p2)
1528
vn = get_varnames(ds_nc)

0 commit comments

Comments
 (0)