aboutsummaryrefslogtreecommitdiff
path: root/python/pyspark/tests.py
diff options
context:
space:
mode:
authorDavies Liu <davies@databricks.com>2015-10-19 16:18:20 -0700
committerAndrew Or <andrew@databricks.com>2015-10-19 16:18:20 -0700
commit232d7f8d42950431f1d9be2a6bb3591fb6ea20d6 (patch)
tree38abfac2a3d362fb4f8e62cc91d57791c6370ad3 /python/pyspark/tests.py
parenta1413b3662250dd5e980e8b1f7c3dc4585ab4766 (diff)
downloadspark-232d7f8d42950431f1d9be2a6bb3591fb6ea20d6.tar.gz
spark-232d7f8d42950431f1d9be2a6bb3591fb6ea20d6.tar.bz2
spark-232d7f8d42950431f1d9be2a6bb3591fb6ea20d6.zip
[SPARK-11114][PYSPARK] add getOrCreate for SparkContext/SQLContext in Python
Also added SQLContext.newSession() Author: Davies Liu <davies@databricks.com> Closes #9122 from davies/py_create.
Diffstat (limited to 'python/pyspark/tests.py')
-rw-r--r--python/pyspark/tests.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/python/pyspark/tests.py b/python/pyspark/tests.py
index 63cc87e0c4..3c51809444 100644
--- a/python/pyspark/tests.py
+++ b/python/pyspark/tests.py
@@ -1883,6 +1883,10 @@ class ContextTests(unittest.TestCase):
# Regression test for SPARK-1550
self.assertRaises(Exception, lambda: SparkContext("an-invalid-master-name"))
+ def test_get_or_create(self):
+ with SparkContext.getOrCreate() as sc:
+ self.assertTrue(SparkContext.getOrCreate() is sc)
+
def test_stop(self):
sc = SparkContext()
self.assertNotEqual(SparkContext._active_spark_context, None)