squito commented on a change in pull request #23337: [SPARK-26019][PYSPARK] 
Allow insecure py4j gateways
URL: https://github.com/apache/spark/pull/23337#discussion_r244843141
 
 

 ##########
 File path: python/pyspark/tests.py
 ##########
 @@ -2381,6 +2382,32 @@ def test_startTime(self):
         with SparkContext() as sc:
             self.assertGreater(sc.startTime, 0)
 
+    def test_forbid_insecure_gateway(self):
+        # By default, we fail immediately if you try to create a SparkContext
+        # with an insecure gateway
+        gateway = _launch_gateway(insecure=True)
+        with self.assertRaises(Exception) as context:
 
 Review comment:
   the problem isn't the nesting of the `with` statements, its that `self.sc` 
you're passing into `QuietTest`.  That doesn't exist in this situation.  The 
point of this test is to get a failure inside the creation of the `sc`, so 
there is nothing i can pass in here.
   
   But, `QuietTest` doesn't actually care about the `sc`, it just wants a 
handle on the jvm, to set the log4j configuration.  My manual `try / finally` 
does the same thing from the handle to the jvm in the java gateway.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to