diff --git a/python/pyspark/pipelines/tests/test_spark_connect.py b/python/pyspark/pipelines/tests/test_spark_connect.py index 3027de46864f..b0cd38f091ce 100644 --- a/python/pyspark/pipelines/tests/test_spark_connect.py +++ b/python/pyspark/pipelines/tests/test_spark_connect.py @@ -21,16 +21,6 @@ import unittest -from pyspark.errors.exceptions.connect import AnalysisException -from pyspark.pipelines.graph_element_registry import graph_element_registration_context -from pyspark.pipelines.spark_connect_graph_element_registry import ( - SparkConnectGraphElementRegistry, -) -from pyspark.pipelines.spark_connect_pipeline import ( - create_dataflow_graph, - start_run, - handle_pipeline_events, -) from pyspark import pipelines as dp from pyspark.testing.connectutils import ( ReusedConnectTestCase, @@ -38,6 +28,18 @@ connect_requirement_message, ) +if should_test_connect: + from pyspark.errors.exceptions.connect import AnalysisException + from pyspark.pipelines.graph_element_registry import graph_element_registration_context + from pyspark.pipelines.spark_connect_graph_element_registry import ( + SparkConnectGraphElementRegistry, + ) + from pyspark.pipelines.spark_connect_pipeline import ( + create_dataflow_graph, + start_run, + handle_pipeline_events, + ) + @unittest.skipIf(not should_test_connect, connect_requirement_message) class SparkConnectPipelinesTest(ReusedConnectTestCase):