You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by qu...@apache.org on 2023/06/12 16:24:22 UTC

[arrow-julia] branch main updated: cleanup testing (#462)

This is an automated email from the ASF dual-hosted git repository.

quinnj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-julia.git


The following commit(s) were added to refs/heads/main by this push:
     new 5532270  cleanup testing (#462)
5532270 is described below

commit 5532270a27ce33ce98e640f28a8f597680786042
Author: Ben Baumgold <49...@users.noreply.github.com>
AuthorDate: Mon Jun 12 12:24:17 2023 -0400

    cleanup testing (#462)
    
    1. Re-enable commented-out test from #456
    2. Use separate test-specific Project.toml to allow for test-specific
    compat (and remove compat shim)
    3. Replace testing println with testsets
---
 Project.toml                           | 15 ---------
 src/ArrowTypes/Project.toml            |  9 ------
 src/ArrowTypes/{ => test}/Project.toml | 16 ---------
 Project.toml => test/Project.toml      | 52 +++++++++---------------------
 test/pyarrow_roundtrip.jl              |  8 +++--
 test/runtests.jl                       | 59 ++++++++++++++++------------------
 test/testappend.jl                     |  3 +-
 test/testtables.jl                     |  4 +--
 8 files changed, 52 insertions(+), 114 deletions(-)

diff --git a/Project.toml b/Project.toml
index c31128d..167cb9a 100644
--- a/Project.toml
+++ b/Project.toml
@@ -45,7 +45,6 @@ CodecZstd = "0.7"
 ConcurrentUtilities = "2"
 DataAPI = "1"
 EnumX = "1"
-FilePathsBase = "0.9"
 LoggingExtras = "0.4, 1"
 PooledArrays = "0.5, 1.0"
 SentinelArrays = "1"
@@ -53,17 +52,3 @@ Tables = "1.1"
 TimeZones = "1"
 TranscodingStreams = "0.9.12"
 julia = "1.6"
-
-[extras]
-CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
-DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
-FilePathsBase = "48062228-2e41-5def-b9a4-89aafe57970f"
-JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
-Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
-Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
-StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4"
-TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
-Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
-
-[targets]
-test = ["CategoricalArrays", "DataFrames", "FilePathsBase", "JSON3", "Random", "StructTypes", "TOML", "Test", "Sockets"]
diff --git a/src/ArrowTypes/Project.toml b/src/ArrowTypes/Project.toml
index cf58e80..95f411c 100644
--- a/src/ArrowTypes/Project.toml
+++ b/src/ArrowTypes/Project.toml
@@ -26,12 +26,3 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
 
 [compat]
 julia = "1.0"
-
-[extras]
-Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
-Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
-Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
-UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
-
-[targets]
-test = ["Test", "Random", "Sockets", "UUIDs"]
diff --git a/src/ArrowTypes/Project.toml b/src/ArrowTypes/test/Project.toml
similarity index 71%
copy from src/ArrowTypes/Project.toml
copy to src/ArrowTypes/test/Project.toml
index cf58e80..24d0f27 100644
--- a/src/ArrowTypes/Project.toml
+++ b/src/ArrowTypes/test/Project.toml
@@ -15,23 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-name = "ArrowTypes"
-uuid = "31f734f8-188a-4ce0-8406-c8a06bd891cd"
-authors = ["quinnj <qu...@gmail.com>"]
-version = "2.2.2"
-
 [deps]
 Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
-UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
-
-[compat]
-julia = "1.0"
-
-[extras]
-Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
-Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
 Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
 UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
-
-[targets]
-test = ["Test", "Random", "Sockets", "UUIDs"]
diff --git a/Project.toml b/test/Project.toml
similarity index 65%
copy from Project.toml
copy to test/Project.toml
index c31128d..93977a9 100644
--- a/Project.toml
+++ b/test/Project.toml
@@ -14,56 +14,34 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-name = "Arrow"
-uuid = "69666777-d1a9-59fb-9406-91d4454c9d45"
-authors = ["quinnj <qu...@gmail.com>"]
-version = "2.6.2"
-
 [deps]
 ArrowTypes = "31f734f8-188a-4ce0-8406-c8a06bd891cd"
-BitIntegers = "c3b6d118-76ef-56ca-8cc7-ebb389d030a1"
-CodecLz4 = "5ba52731-8f18-5e0d-9241-30f10d1ec561"
-CodecZstd = "6b39b394-51ab-5f42-8807-6242bab2b4c2"
-ConcurrentUtilities = "f0e56b4a-5159-44fe-b623-3e5288b988bb"
+CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
 DataAPI = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
+DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
 Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
-EnumX = "4e289a0a-7415-4d19-859d-a7e5c4648b56"
-LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36"
+FilePathsBase = "48062228-2e41-5def-b9a4-89aafe57970f"
+JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
 Mmap = "a63ad114-7e13-5084-954f-fe012c677804"
 PooledArrays = "2dfb63ee-cc39-5dd5-95bd-886bf059d720"
+Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
+Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
+StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4"
 SentinelArrays = "91c51154-3ec4-41a3-a24f-3f23e20d615c"
 Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
 TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"
-TranscodingStreams = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
+Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
 UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
 
 [compat]
-ArrowTypes = "1.1,2"
-BitIntegers = "0.2, 0.3"
-CodecLz4 = "0.4"
-CodecZstd = "0.7"
-ConcurrentUtilities = "2"
+ArrowTypes = "2.2.2"
+CategoricalArrays = "0.10"
 DataAPI = "1"
-EnumX = "1"
+DataFrames = "1"
 FilePathsBase = "0.9"
-LoggingExtras = "0.4, 1"
-PooledArrays = "0.5, 1.0"
+JSON3 = "1"
+PooledArrays = "1"
+StructTypes = "1"
 SentinelArrays = "1"
-Tables = "1.1"
+Tables = "1"
 TimeZones = "1"
-TranscodingStreams = "0.9.12"
-julia = "1.6"
-
-[extras]
-CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
-DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
-FilePathsBase = "48062228-2e41-5def-b9a4-89aafe57970f"
-JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
-Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
-Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
-StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4"
-TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
-Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
-
-[targets]
-test = ["CategoricalArrays", "DataFrames", "FilePathsBase", "JSON3", "Random", "StructTypes", "TOML", "Test", "Sockets"]
diff --git a/test/pyarrow_roundtrip.jl b/test/pyarrow_roundtrip.jl
index 537ff92..97b48b7 100644
--- a/test/pyarrow_roundtrip.jl
+++ b/test/pyarrow_roundtrip.jl
@@ -21,7 +21,7 @@ include(joinpath(dirname(pathof(Arrow)), "../test/testtables.jl"))
 
 for (nm, t, writekw, readkw, extratests) in testtables
     nm == "unions" && continue
-    println("pyarrow roundtrip: $nm")
+    @testset "pyarrow roundtrip: $nm" begin
     io = IOBuffer()
     Arrow.write(io, t; writekw...)
     seekstart(io)
@@ -36,7 +36,8 @@ for (nm, t, writekw, readkw, extratests) in testtables
     buf = sink.getvalue()
     jbytes = copy(reinterpret(UInt8, buf))
     tt = Arrow.Table(jbytes)
-    println("pyarrow roundtrip w/ compression: $nm")
+    end
+    @testset "pyarrow roundtrip w/ compression: $nm" begin
     io = IOBuffer()
     Arrow.write(io, t; compress=((:lz4, :zstd)[rand(1:2)]), writekw...)
     seekstart(io)
@@ -51,6 +52,7 @@ for (nm, t, writekw, readkw, extratests) in testtables
     buf = sink.getvalue()
     jbytes = copy(reinterpret(UInt8, buf))
     tt = Arrow.Table(jbytes)
+    end
 end
 
 f1 = pa.field("f1", pa.float64(), true)
@@ -71,4 +73,4 @@ writer.write_batch(batch)
 writer.close()
 buf = sink.getvalue()
 jbytes = copy(reinterpret(UInt8, buf))
-tt = Arrow.Table(jbytes)
\ No newline at end of file
+tt = Arrow.Table(jbytes)
diff --git a/test/runtests.jl b/test/runtests.jl
index 1c8903f..edeb4d1 100644
--- a/test/runtests.jl
+++ b/test/runtests.jl
@@ -14,18 +14,20 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-using Test, Arrow, ArrowTypes, Tables, Dates, PooledArrays, TimeZones, UUIDs, Sockets,
-    CategoricalArrays, DataAPI, FilePathsBase, DataFrames
-using Random: randstring
-
-# Compat shim for pre-julia 1.9
-if !@isdefined(pkgversion)
-    using TOML
-    function pkgversion(m::Module)
-        toml = TOML.parsefile(joinpath(pkgdir(m), "Project.toml"))
-        return VersionNumber(toml["version"])
-    end
-end
+using Test
+using Arrow
+using ArrowTypes
+using Tables
+using Dates
+using PooledArrays
+using TimeZones
+using UUIDs
+using Sockets
+using CategoricalArrays
+using DataAPI
+using FilePathsBase
+using DataFrames
+import Random: randstring
 
 include(joinpath(dirname(pathof(ArrowTypes)), "../test/tests.jl"))
 include(joinpath(dirname(pathof(Arrow)), "../test/testtables.jl"))
@@ -72,11 +74,12 @@ end # @testset "table append"
 
 for file in readdir(joinpath(dirname(pathof(Arrow)), "../test/arrowjson"))
     jsonfile = joinpath(joinpath(dirname(pathof(Arrow)), "../test/arrowjson"), file)
-    println("integration test for $jsonfile")
+    @testset "integration test for $jsonfile" begin
     df = ArrowJSON.parsefile(jsonfile);
     io = Arrow.tobuffer(df)
     tbl = Arrow.Table(io; convert=false);
     @test isequal(df, tbl)
+    end
 end
 
 end # @testset "arrow json integration tests"
@@ -605,21 +608,15 @@ table = Arrow.Table(joinpath(@__DIR__, "old_zdt.arrow"))
 end
 
 @testset "# 243" begin
-if pkgversion(ArrowTypes) >= v"2.0.1" # need the ArrowTypes bugfix to pass this test
-    # https://github.com/apache/arrow-julia/issues/243
-    table = (; col = [(; v=v"1"), (; v=v"2"), missing])
-    @test isequal(Arrow.Table(Arrow.tobuffer(table)).col, table.col)
-end
+table = (; col = [(; v=v"1"), (; v=v"2"), missing])
+@test isequal(Arrow.Table(Arrow.tobuffer(table)).col, table.col)
 end
 
 @testset "# 367" begin
-# https://github.com/apache/arrow-julia/issues/367
-if pkgversion(ArrowTypes) >= v"2.0.2"
-    t = (; x=Union{ZonedDateTime,Missing}[missing])
-    a = Arrow.Table(Arrow.tobuffer(t))
-    @test Tables.schema(a) == Tables.schema(t)
-    @test isequal(a.x, t.x)
-end
+t = (; x=Union{ZonedDateTime,Missing}[missing])
+a = Arrow.Table(Arrow.tobuffer(t))
+@test Tables.schema(a) == Tables.schema(t)
+@test isequal(a.x, t.x)
 end
 
 # https://github.com/apache/arrow-julia/issues/414
@@ -707,14 +704,14 @@ t = Arrow.Table(buf)
 
 end
 
-# @testset "# 456" begin
+@testset "# 456" begin
 
-# NT = @NamedTuple{x::Int, y::Union{Missing,Int}}
-# data = NT[(x=1,y=2), (x=2,y=missing), (x=3,y=4), (x=4,y=5)]
-# t = [(a=1,b=view(data,1:2)), (a=2,b=view(data,3:4)), missing]
-# @test Arrow.toarrowvector(t) isa Arrow.Struct
+NT = @NamedTuple{x::Int, y::Union{Missing,Int}}
+data = NT[(x=1,y=2), (x=2,y=missing), (x=3,y=4), (x=4,y=5)]
+t = [(a=1,b=view(data,1:2)), (a=2,b=view(data,3:4)), missing]
+@test Arrow.toarrowvector(t) isa Arrow.Struct
 
-# end
+end
 
 end # @testset "misc"
 
diff --git a/test/testappend.jl b/test/testappend.jl
index 1fc3fad..dace951 100644
--- a/test/testappend.jl
+++ b/test/testappend.jl
@@ -16,7 +16,7 @@
 # under the License.
 
 function testappend(nm, t, writekw, readkw, extratests)
-    println("testing append: $nm")
+    @testset "append: $nm" begin
     io = Arrow.tobuffer(t; writekw...)
     bytes = read(io)
     mktemp() do path, io
@@ -33,6 +33,7 @@ function testappend(nm, t, writekw, readkw, extratests)
         end
         @test nparts == 2
     end
+    end
 end
 
 function testappend_compression(compression_option)
diff --git a/test/testtables.jl b/test/testtables.jl
index 10c1671..f143705 100644
--- a/test/testtables.jl
+++ b/test/testtables.jl
@@ -220,7 +220,7 @@ testtables = [
 ];
 
 function testtable(nm, t, writekw, readkw, extratests)
-  println("testing: $nm")
+  @testset "testing: $nm" begin
   io = Arrow.tobuffer(t; writekw...)
   tt = Arrow.Table(io; readkw...)
   @test length(tt) == length(t)
@@ -253,5 +253,5 @@ function testtable(nm, t, writekw, readkw, extratests)
   tt = first(str)
   @test length(tt) == length(t)
   @test all(isequal.(values(t), values(tt)))
-  return
+  end
 end