From b4ca73f2efce312b0e1c3b7894f62319f562c29f Mon Sep 17 00:00:00 2001 From: cccs-eric Date: Thu, 13 Jul 2023 14:14:58 -0400 Subject: [PATCH] Disable pyiceberg imports when Python < 3.8 --- .../tests/integration/iceberg/test_iceberg.py | 10 ++++++---- metadata-ingestion/tests/unit/test_iceberg.py | 8 +++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/metadata-ingestion/tests/integration/iceberg/test_iceberg.py b/metadata-ingestion/tests/integration/iceberg/test_iceberg.py index 56e68dd4f3c6a..e2a86480672e5 100644 --- a/metadata-ingestion/tests/integration/iceberg/test_iceberg.py +++ b/metadata-ingestion/tests/integration/iceberg/test_iceberg.py @@ -15,15 +15,17 @@ validate_all_providers_have_committed_successfully, ) -pytestmark = pytest.mark.skipif( - sys.version_info < (3, 8), reason="requires python 3.8 or higher" -) - FROZEN_TIME = "2020-04-14 07:00:00" GMS_PORT = 8080 GMS_SERVER = f"http://localhost:{GMS_PORT}" +@pytest.fixture(autouse=True) +def skip_tests_if_python_before_3_8(): + if sys.version_info < (3, 8): + pytest.skip("Requires python 3.8 or higher") + + def spark_submit(file_path: str, args: str = "") -> None: docker = "docker" command = f"{docker} exec spark-iceberg spark-submit {file_path} {args}" diff --git a/metadata-ingestion/tests/unit/test_iceberg.py b/metadata-ingestion/tests/unit/test_iceberg.py index e487a11e65d8b..b09ffeaaebabb 100644 --- a/metadata-ingestion/tests/unit/test_iceberg.py +++ b/metadata-ingestion/tests/unit/test_iceberg.py @@ -51,9 +51,11 @@ TimeTypeClass, ) -pytestmark = pytest.mark.skipif( - sys.version_info < (3, 8), reason="requires python 3.8 or higher" -) + +@pytest.fixture(autouse=True) +def skip_tests_if_python_before_3_8(): + if sys.version_info < (3, 8): + pytest.skip("Requires python 3.8 or higher") def with_iceberg_source() -> IcebergSource: