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

gurwls223 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 d7430124191a [SPARK-47753][PYTHON][CONNECT][TESTS] Make 
pyspark.testing compatible with pyspark-connect
d7430124191a is described below

commit d7430124191ab1f010b2ac873dbbeee5ff9caf52
Author: Hyukjin Kwon <gurwls...@apache.org>
AuthorDate: Sun Apr 7 18:34:30 2024 +0900

    [SPARK-47753][PYTHON][CONNECT][TESTS] Make pyspark.testing compatible with 
pyspark-connect
    
    ### What changes were proposed in this pull request?
    
    This PR proposes to make `pyspark.testing` compatible with 
`pyspark-connect` by using noop context manager `contextlib.nullcontext` 
instead of `QuietTest` which requires JVM access.
    
    ### Why are the changes needed?
    
    In order for `pyspark-connect` to work without classic PySpark packages and 
dependencies. Also, the logs are hidden as it's written to the separate file so 
it is actually already quiet.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Yes, at https://github.com/apache/spark/pull/45870. Once CI is setup there, 
it will be tested there properly.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #45916 from HyukjinKwon/SPARK-47753.
    
    Authored-by: Hyukjin Kwon <gurwls...@apache.org>
    Signed-off-by: Hyukjin Kwon <gurwls...@apache.org>
---
 python/pyspark/testing/connectutils.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/python/pyspark/testing/connectutils.py 
b/python/pyspark/testing/connectutils.py
index 5cb553c4949a..191505741eb4 100644
--- a/python/pyspark/testing/connectutils.py
+++ b/python/pyspark/testing/connectutils.py
@@ -21,6 +21,7 @@ import os
 import functools
 import unittest
 import uuid
+import contextlib
 
 grpc_requirement_message = None
 try:
@@ -208,3 +209,5 @@ class ReusedConnectTestCase(unittest.TestCase, 
SQLTestUtils, PySparkErrorTestUti
 
         if self._legacy_sc is not None:
             return QuietTest(self._legacy_sc)
+        else:
+            return contextlib.nullcontext()


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

Reply via email to