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:27:38 UTC
[GitHub] [spark] sandeep-katta commented on a change in pull request #24021:
[SPARK-27101][Pyspark]Cleaning up the python testcases
sandeep-katta 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_r263731702
##########
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:
SQLTestUtils excepts spark session to be present [Code here](https://github.com/apache/spark/blob/master/python/pyspark/testing/sqlutils.py#L196). So have ReusedSQLTestCase which will create spark session and inherits `unittest.TestCase, SQLTestUtils`
----------------------------------------------------------------
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