Github user zero323 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16536#discussion_r98093311
  
    --- Diff: python/pyspark/sql/tests.py ---
    @@ -476,6 +476,19 @@ def test_udf_defers_judf_initalization(self):
                 "judf should be initialized after UDF has been called."
             )
     
    +    @unittest.skipIf(sys.version_info < (3, 3), "Unittest < 3.3 doesn't 
support mocking")
    --- End diff --
    
    ```python
    class UDFInitializationTestCase(unittest.TestCase):
        def tearDown(self):
            if SparkSession._instantiatedSession is not None:
                SparkSession._instantiatedSession.stop()
    
            if SparkContext._active_spark_context is not None:
                SparkContext._active_spark_contex.stop()
    
        def test_udf_context_access(self):
            from pyspark.sql.functions import UserDefinedFunction
            f = UserDefinedFunction(lambda x: x, StringType())
            self.assertIsNone(SparkContext._active_spark_context)
            self.assertIsNone(SparkSession._instantiatedSession)
                
    ```



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to