From b7cf14e3b195064d8740b8f2ab306d8729e54dc2 Mon Sep 17 00:00:00 2001 From: Fokko Driesprong Date: Wed, 31 Jan 2024 08:55:52 +0100 Subject: [PATCH] Allow running the Avro decoder tests without Arrow (#335) * Allow running the Avro decoder tests without Arrow It looks like PyArrow binaries are not available for all architectures, and therefore it tries to compile it locally when it isn't available. We want to avoid this since Arrow requires a rather complicated buildchain. * Revert unnecessary move --- .github/workflows/python-release.yml | 2 +- tests/conftest.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index 52f523da93..2d51aa3d17 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -68,7 +68,7 @@ jobs: CIBW_ARCHS: "auto64" CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8,<3.12" CIBW_TEST_REQUIRES: "pytest==7.4.2 moto==4.2.2" - CIBW_TEST_EXTRAS: "s3fs,glue,pyarrow" + CIBW_TEST_EXTRAS: "s3fs,glue" CIBW_TEST_COMMAND: "pytest {project}/tests/avro/test_decoder.py" # There is an upstream issue with installing on MacOSX # https://github.com/pypa/cibuildwheel/issues/1603 diff --git a/tests/conftest.py b/tests/conftest.py index 86c7f1cd33..063c0646fd 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -44,7 +44,6 @@ from urllib.parse import urlparse import boto3 -import pyarrow as pa import pytest from moto import mock_dynamodb, mock_glue @@ -85,6 +84,7 @@ from pyiceberg.utils.datetime import datetime_to_millis if TYPE_CHECKING: + import pyarrow as pa from moto.server import ThreadedMotoServer # type: ignore from pyiceberg.io.pyarrow import PyArrowFile, PyArrowFileIO @@ -267,7 +267,9 @@ def table_schema_nested_with_struct_key_map() -> Schema: @pytest.fixture(scope="session") -def pyarrow_schema_simple_without_ids() -> pa.Schema: +def pyarrow_schema_simple_without_ids() -> "pa.Schema": + import pyarrow as pa + return pa.schema([ pa.field('foo', pa.string(), nullable=True), pa.field('bar', pa.int32(), nullable=False), @@ -276,7 +278,9 @@ def pyarrow_schema_simple_without_ids() -> pa.Schema: @pytest.fixture(scope="session") -def pyarrow_schema_nested_without_ids() -> pa.Schema: +def pyarrow_schema_nested_without_ids() -> "pa.Schema": + import pyarrow as pa + return pa.schema([ pa.field('foo', pa.string(), nullable=False), pa.field('bar', pa.int32(), nullable=False),