Skip to content

Commit

Permalink
Fixes for Julia 1.5 (#41)
Browse files Browse the repository at this point in the history
* Fixes for Julia 1.5

* Remove some tests again

* Run a full PkgSkeleton update

* tweak codecov

* Fix some windows tests

* Be explicit about Int type in tests
  • Loading branch information
meggart authored Sep 17, 2020
1 parent ff3491f commit e59f5b3
Show file tree
Hide file tree
Showing 14 changed files with 90 additions and 27 deletions.
1 change: 1 addition & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
comment: false
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
language: julia
codecov: true
os:
- osx
- linux
julia:
- 1.2
- 1
- 1.3
- nightly

Expand All @@ -23,5 +22,6 @@ jobs:
- julia --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- julia --project=docs docs/make.jl
after_success: skip
#after_success:
#- julia -e 'import Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder()); Codecov.submit(Codecov.process_folder())'
after_success:
- julia --project=test/coverage -e 'using Pkg; Pkg.instantiate()'
- julia --project=test/coverage test/coverage/coverage.jl
42 changes: 42 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
environment:
matrix:
- julia_version: 1
- julia_version: nightly

platform:
- x86 # 32-bit
- x64 # 64-bit

# # Uncomment the following lines to allow failures on nightly julia
# # (tests will run but not make your overall status red)
# matrix:
# allow_failures:
# - julia_version: nightly

branches:
only:
- master
- /release-.*/

notifications:
- provider: Email
on_build_success: false
on_build_failure: false
on_build_status_changed: false

install:
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))

build_script:
- echo "%JL_BUILD_SCRIPT%"
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"

test_script:
- echo "%JL_TEST_SCRIPT%"
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"

# # Uncomment to support code coverage upload. Should only be enabled for packages
# # which would have coverage gaps without running on Windows
# on_success:
# - echo "%JL_CODECOV_SCRIPT%"
# - C:\julia\bin\julia -e "%JL_CODECOV_SCRIPT%"
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ AWSCore = "4f1ea46c-232b-54a6-9b17-cc2d0f3e6598"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Zarr = "0a941bbe-ad1d-11e8-39d9-ab76183a1d99"
2 changes: 1 addition & 1 deletion src/Storage/Storage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function getsub end
Deletes the given key from the store.
"""

citostring(i::CartesianIndex) = join(reverse((i - one(i)).I), '.')
citostring(i::CartesianIndex) = join(reverse((i - oneunit(i)).I), '.')

Base.getindex(s::AbstractStore, i::CartesianIndex) = s[citostring(i)]
Base.delete!(s::AbstractStore, i::CartesianIndex) = delete!(s, citostring(i))
Expand Down
4 changes: 2 additions & 2 deletions src/Storage/http.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct HTTPStore <: AbstractStore
end

function Base.getindex(s::HTTPStore, k::String)
r = HTTP.request("GET",joinpath(s.url,k),status_exception = false)
r = HTTP.request("GET",string(s.url,"/",k),status_exception = false)
if r.status >= 300
if r.status == 404
nothing
Expand All @@ -24,7 +24,7 @@ else
r.body
end
end
getsub(s::HTTPStore,n) = HTTPStore(joinpath(s.url,n))
getsub(s::HTTPStore,n) = HTTPStore(string(s.url,"/",n))
zname(s::HTTPStore) = split(s.url,"/")[end]


Expand Down
8 changes: 4 additions & 4 deletions src/Storage/s3store.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ end

function Base.getindex(s::S3Store, i::String)
try
return S3.get_object(s.aws,Bucket=s.bucket,Key=joinpath(s.store,i))
return S3.get_object(s.aws,Bucket=s.bucket,Key=string(s.store,"/",i))
catch e
if error_is_ignorable(e)
return nothing
Expand All @@ -38,7 +38,7 @@ function Base.getindex(s::S3Store, i::String)
end
end
end
getsub(s::S3Store, d::String) = S3Store(s.bucket, joinpath(s.store,d), s.listversion, s.aws)
getsub(s::S3Store, d::String) = S3Store(s.bucket, string(s.store,"/",d), s.listversion, s.aws)

function storagesize(s::S3Store)
r = cloud_list_objects(s)
Expand All @@ -62,13 +62,13 @@ end

function isinitialized(s::S3Store, i::String)
try
S3.head_object(s.aws,Bucket=s.bucket,Key=joinpath(s.store,i))
S3.head_object(s.aws,Bucket=s.bucket,Key=string(s.store,"/",i))
return true
catch e
if error_is_ignorable(e)
return false
else
println(joinpath(s.store,i))
println(string(s.store,"/",i))
throw(e)
end
end
Expand Down
6 changes: 3 additions & 3 deletions src/ZArray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import FillArrays: Fill
import OffsetArrays: OffsetArray
import DiskArrays: AbstractDiskArray
import DiskArrays
getfillval(target::Type{T}, t::String) where {T <: Number} = parse(T, t)
getfillval(target::Type{T}, t::Union{T,Nothing}) where {T} = t
getfillval(::Type{T}, t::String) where {T <: Number} = parse(T, t)
getfillval(::Type{T}, t::Union{T,Nothing}) where {T} = t

struct SenMissArray{T,N,V} <: AbstractArray{Union{T,Missing},N}
x::Array{T,N}
Expand Down Expand Up @@ -256,7 +256,7 @@ function zcreate(::Type{T},storage::AbstractStore,
length(dims) == length(chunks) || throw(DimensionMismatch("Dims must have the same length as chunks"))
N = length(dims)
C = typeof(compressor)
T2 = fill_value == nothing ? T : Union{T,Missing}
T2 = fill_value === nothing ? T : Union{T,Missing}
metadata = Metadata{T2, N, C}(
2,
dims,
Expand Down
4 changes: 2 additions & 2 deletions src/metadata.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ typestr(t::Type{<:Signed}) = string('<', 'i', sizeof(t))
typestr(t::Type{<:Unsigned}) = string('<', 'u', sizeof(t))
typestr(t::Type{Complex{T}} where T<:AbstractFloat) = string('<', 'c', sizeof(t))
typestr(t::Type{<:AbstractFloat}) = string('<', 'f', sizeof(t))
typestr(t::Type{MaxLengthString{N,UInt32}}) where {N,T} = string('<', 'U', N)
typestr(t::Type{MaxLengthString{N,UInt8}}) where {N,T} = string('<', 'S', N)
typestr(::Type{MaxLengthString{N,UInt32}}) where N = string('<', 'U', N)
typestr(::Type{MaxLengthString{N,UInt8}}) where N = string('<', 'S', N)

const typestr_regex = r"^([<|>])([tbiufcmMOSUV])(\d+)$"
const typemap = Dict{Tuple{Char, Int}, DataType}(
Expand Down
2 changes: 2 additions & 0 deletions test/coverage/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[deps]
Coverage = "a2441757-f6aa-5fb2-8edb-039e3f45d037"
12 changes: 12 additions & 0 deletions test/coverage/coverage-summary.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
####
#### Coverage summary, printed as "(percentage) covered".
####
#### Useful for CI environments that just want a summary (eg a Gitlab setup).
####

using Coverage
cd(joinpath(@__DIR__, "..", "..")) do
covered_lines, total_lines = get_summary(process_folder())
percentage = covered_lines / total_lines * 100
println("($(percentage)%) covered")
end
9 changes: 9 additions & 0 deletions test/coverage/coverage.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# only push coverage from one bot
get(ENV, "TRAVIS_OS_NAME", nothing) == "linux" || exit(0)
get(ENV, "TRAVIS_JULIA_VERSION", nothing) == "1.5" || exit(0)

using Coverage

cd(joinpath(@__DIR__, "..", "..")) do
Codecov.submit(Codecov.process_folder())
end
12 changes: 6 additions & 6 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ using PyCall

@testset "ZArray" begin
@testset "fields" begin
z = zzeros(Int, 2, 3)
@test z isa ZArray{Int, 2, Zarr.BloscCompressor,
z = zzeros(Int64, 2, 3)
@test z isa ZArray{Int64, 2, Zarr.BloscCompressor,
Zarr.DictStore}

@test z.storage.name === "data"
Expand All @@ -31,11 +31,11 @@ using PyCall
end

@testset "methods" begin
z = zzeros(Int, 2, 3)
@test z isa ZArray{Int, 2, Zarr.BloscCompressor,
z = zzeros(Int64, 2, 3)
@test z isa ZArray{Int64, 2, Zarr.BloscCompressor,
Zarr.DictStore}

@test eltype(z) === Int
@test eltype(z) === Int64
@test ndims(z) === 2
@test size(z) === (2, 3)
@test size(z, 2) === 3
Expand All @@ -47,7 +47,7 @@ using PyCall
@testset "NoCompressor DirectoryStore" begin
mktempdir(@__DIR__) do dir
name = "nocompressor"
z = zzeros(Int, 2, 3, path="$dir/$name",
z = zzeros(Int64, 2, 3, path="$dir/$name",
compressor=Zarr.NoCompressor())

@test z.metadata.compressor === Zarr.NoCompressor()
Expand Down
6 changes: 1 addition & 5 deletions test/storage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ end
@test isdir(joinpath(p,"foo","bar"))
@test isfile(joinpath(p,"foo","bar","0.0.0"))
@test isfile(joinpath(p,"foo","bar",".zarray"))
@test Zarr.path(ds)==joinpath(p,"foo")
@test Zarr.path(ds)==replace(joinpath(p,"foo"),"\\"=>"/")
end

@testset "DictStore" begin
Expand All @@ -75,9 +75,6 @@ end
import AWSCore: aws_config

@testset "AWS S3 Storage" begin
# These tests work locally but not on Travis, not idea why, will skip them for now
# TODO fix
#if get(ENV,"TRAVIS","") != "true"
bucket = "zarr-demo"
store = "store/foo"
region = "eu-west-2"
Expand All @@ -92,7 +89,6 @@ import AWSCore: aws_config
@test eltype(S3Array) == Zarr.ASCIIChar
@test storagesize(S3Array) == 69
@test String(S3Array[:]) == "Hello from the cloud!"
#end
end

@testset "GCS S3 Storage" begin
Expand Down

2 comments on commit e59f5b3

@meggart
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: "Tag with name v0.4.5 already exists and points to a different commit"

Please sign in to comment.