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

honahx pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-python.git


The following commit(s) were added to refs/heads/main by this push:
     new 5ef9f3d1 Tests: Make Spark optional for testing (#568)
5ef9f3d1 is described below

commit 5ef9f3d1d6cb109ebde94a3db4794d5fc066cac3
Author: Fokko Driesprong <[email protected]>
AuthorDate: Mon Apr 1 17:04:42 2024 +0200

    Tests: Make Spark optional for testing (#568)
    
    For the release, we check the Avro decoder, but we don't
    want to install PySpark all the time.
---
 tests/conftest.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/conftest.py b/tests/conftest.py
index d0f0d592..8c381a1c 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -46,7 +46,6 @@ from typing import (
 import boto3
 import pytest
 from moto import mock_aws
-from pyspark.sql import SparkSession
 
 from pyiceberg import schema
 from pyiceberg.catalog import Catalog, load_catalog
@@ -86,6 +85,7 @@ from pyiceberg.utils.datetime import datetime_to_millis
 if TYPE_CHECKING:
     import pyarrow as pa
     from moto.server import ThreadedMotoServer  # type: ignore
+    from pyspark.sql import SparkSession
 
     from pyiceberg.io.pyarrow import PyArrowFileIO
 
@@ -1954,9 +1954,10 @@ def session_catalog() -> Catalog:
 
 
 @pytest.fixture(scope="session")
-def spark() -> SparkSession:
+def spark() -> "SparkSession":
     import importlib.metadata
-    import os
+
+    from pyspark.sql import SparkSession
 
     spark_version = 
".".join(importlib.metadata.version("pyspark").split(".")[:2])
     scala_version = "2.12"

Reply via email to