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

ruifengz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 1a3ae66c6c48 [MINOR][PYTHON][TESTS] Skip pipeline tests if yaml not 
installed
1a3ae66c6c48 is described below

commit 1a3ae66c6c48bb319f0798826085e694fa7d0b58
Author: Ruifeng Zheng <ruife...@apache.org>
AuthorDate: Tue Jun 10 11:22:37 2025 +0800

    [MINOR][PYTHON][TESTS] Skip pipeline tests if yaml not installed
    
    ### What changes were proposed in this pull request?
    Skip pipeline test if yaml not installed
    
    ### Why are the changes needed?
    to restore scheduled workflows
    
    ### Does this PR introduce _any_ user-facing change?
    no, test-only
    
    ### How was this patch tested?
    PR builder with
    ```
    default: '{"PYSPARK_IMAGE_TO_TEST": "python-minimum", "PYTHON_TO_TEST": 
"python3.9"}'
    ```
    
    
https://github.com/zhengruifeng/spark/actions/runs/15530526175/job/43718317057
    
    ### Was this patch authored or co-authored using generative AI tooling?
    no
    
    Closes #51139 from zhengruifeng/fix_pp_yaml.
    
    Authored-by: Ruifeng Zheng <ruife...@apache.org>
    Signed-off-by: Ruifeng Zheng <ruife...@apache.org>
---
 python/pyspark/pipelines/tests/test_cli.py      | 8 ++++++--
 python/pyspark/pipelines/tests/test_init_cli.py | 9 +++++++--
 python/pyspark/testing/utils.py                 | 3 +++
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/python/pyspark/pipelines/tests/test_cli.py 
b/python/pyspark/pipelines/tests/test_cli.py
index 3f372fba2606..92de53029f78 100644
--- a/python/pyspark/pipelines/tests/test_cli.py
+++ b/python/pyspark/pipelines/tests/test_cli.py
@@ -25,8 +25,9 @@ from pyspark.testing.connectutils import (
     should_test_connect,
     connect_requirement_message,
 )
+from pyspark.testing.utils import have_yaml, yaml_requirement_message
 
-if should_test_connect:
+if should_test_connect and have_yaml:
     from pyspark.pipelines.cli import (
         change_dir,
         find_pipeline_spec,
@@ -39,7 +40,10 @@ if should_test_connect:
     from pyspark.pipelines.tests.local_graph_element_registry import 
LocalGraphElementRegistry
 
 
-@unittest.skipIf(not should_test_connect, connect_requirement_message)
+@unittest.skipIf(
+    not should_test_connect or not have_yaml,
+    connect_requirement_message or yaml_requirement_message,
+)
 class CLIUtilityTests(unittest.TestCase):
     def test_load_pipeline_spec(self):
         with tempfile.NamedTemporaryFile(mode="w") as tmpfile:
diff --git a/python/pyspark/pipelines/tests/test_init_cli.py 
b/python/pyspark/pipelines/tests/test_init_cli.py
index 484ee4cb78e5..656e4b609eaa 100644
--- a/python/pyspark/pipelines/tests/test_init_cli.py
+++ b/python/pyspark/pipelines/tests/test_init_cli.py
@@ -23,8 +23,10 @@ from pyspark.testing.connectutils import (
     should_test_connect,
     connect_requirement_message,
 )
+from pyspark.testing.utils import have_yaml, yaml_requirement_message
 
-if should_test_connect:
+
+if should_test_connect and have_yaml:
     from pyspark.pipelines.cli import (
         change_dir,
         find_pipeline_spec,
@@ -35,7 +37,10 @@ if should_test_connect:
     from pyspark.pipelines.tests.local_graph_element_registry import 
LocalGraphElementRegistry
 
 
-@unittest.skipIf(not should_test_connect, connect_requirement_message)
+@unittest.skipIf(
+    not should_test_connect or not have_yaml,
+    connect_requirement_message or yaml_requirement_message,
+)
 class InitCLITests(ReusedConnectTestCase):
     def test_init(self):
         with tempfile.TemporaryDirectory() as temp_dir:
diff --git a/python/pyspark/testing/utils.py b/python/pyspark/testing/utils.py
index 12cc61daf5b5..3daad83d7cb4 100644
--- a/python/pyspark/testing/utils.py
+++ b/python/pyspark/testing/utils.py
@@ -91,6 +91,9 @@ jinja2_requirement_message = None if have_jinja2 else "No 
module named 'jinja2'"
 have_openpyxl = have_package("openpyxl")
 openpyxl_requirement_message = None if have_openpyxl else "No module named 
'openpyxl'"
 
+have_yaml = have_package("yaml")
+yaml_requirement_message = None if have_yaml else "No module named 'yaml'"
+
 pandas_requirement_message = None
 try:
     from pyspark.sql.pandas.utils import require_minimum_pandas_version


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to