You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/03/08 10:51:51 UTC

[GitHub] [spark] HyukjinKwon commented on a change in pull request #24021: [SPARK-27101][Pyspark]Cleaning up the python testcases

HyukjinKwon commented on a change in pull request #24021: [SPARK-27101][Pyspark]Cleaning up the python testcases
URL: https://github.com/apache/spark/pull/24021#discussion_r263738297
 
 

 ##########
 File path: python/pyspark/sql/tests/test_session.py
 ##########
 @@ -103,18 +103,18 @@ def test_SparkSession(self):
             .master("local") \
             .config("some-config", "v2") \
             .getOrCreate()
-        try:
-            self.assertEqual(spark.conf.get("some-config"), "v2")
-            self.assertEqual(spark.sparkContext._conf.get("some-config"), "v2")
-            self.assertEqual(spark.version, spark.sparkContext.version)
-            spark.sql("CREATE DATABASE test_db")
-            spark.catalog.setCurrentDatabase("test_db")
-            self.assertEqual(spark.catalog.currentDatabase(), "test_db")
-            spark.sql("CREATE TABLE table1 (name STRING, age INT) USING parquet")
-            self.assertEqual(spark.table("table1").columns, ['name', 'age'])
-            self.assertEqual(spark.range(3).count(), 3)
-        finally:
-            spark.stop()
+        with self.database("test_db"):
 
 Review comment:
   This set of tests are specific to Spark sessions. Let's don't make another Spark session before the tests. You can just manually drop the database explicitly in finally

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


With regards,
Apache Git Services

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