aboutsummaryrefslogtreecommitdiff
path: root/python/pyspark/tests.py
diff options
context:
space:
mode:
authorJosh Rosen <joshrosen@apache.org>2014-08-11 11:54:09 -0700
committerJosh Rosen <joshrosen@apache.org>2014-08-11 11:54:09 -0700
commitdb06a81fb7a413faa3fe0f8c35918f70454cb05d (patch)
tree7d6b7e1766aadf0a875d5577ee349b73c817ceef /python/pyspark/tests.py
parentba28a8fcbc3ba432e7ea4d6f0b535450a6ec96c6 (diff)
downloadspark-db06a81fb7a413faa3fe0f8c35918f70454cb05d.tar.gz
spark-db06a81fb7a413faa3fe0f8c35918f70454cb05d.tar.bz2
spark-db06a81fb7a413faa3fe0f8c35918f70454cb05d.zip
[PySpark] [SPARK-2954] [SPARK-2948] [SPARK-2910] [SPARK-2101] Python 2.6 Fixes
- Modify python/run-tests to test with Python 2.6 - Use unittest2 when running on Python 2.6. - Fix issue with namedtuple. - Skip TestOutputFormat.test_newhadoop on Python 2.6 until SPARK-2951 is fixed. - Fix MLlib _deserialize_double on Python 2.6. Closes #1868. Closes #1042. Author: Josh Rosen <joshrosen@apache.org> Closes #1874 from JoshRosen/python2.6 and squashes the following commits: 983d259 [Josh Rosen] [SPARK-2954] Fix MLlib _deserialize_double on Python 2.6. 5d18fd7 [Josh Rosen] [SPARK-2948] [SPARK-2910] [SPARK-2101] Python 2.6 fixes
Diffstat (limited to 'python/pyspark/tests.py')
-rw-r--r--python/pyspark/tests.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/python/pyspark/tests.py b/python/pyspark/tests.py
index 88a61176e5..22b51110ed 100644
--- a/python/pyspark/tests.py
+++ b/python/pyspark/tests.py
@@ -29,9 +29,14 @@ import subprocess
import sys
import tempfile
import time
-import unittest
import zipfile
+if sys.version_info[:2] <= (2, 6):
+ import unittest2 as unittest
+else:
+ import unittest
+
+
from pyspark.context import SparkContext
from pyspark.files import SparkFiles
from pyspark.serializers import read_int
@@ -605,6 +610,7 @@ class TestOutputFormat(PySparkTestCase):
conf=input_conf).collect())
self.assertEqual(old_dataset, dict_data)
+ @unittest.skipIf(sys.version_info[:2] <= (2, 6), "Skipped on 2.6 until SPARK-2951 is fixed")
def test_newhadoop(self):
basepath = self.tempdir.name
# use custom ArrayWritable types and converters to handle arrays
@@ -905,8 +911,9 @@ class TestSparkSubmit(unittest.TestCase):
pattern = re.compile(r'^ *\|', re.MULTILINE)
content = re.sub(pattern, '', content.strip())
path = os.path.join(self.programDir, name + ".zip")
- with zipfile.ZipFile(path, 'w') as zip:
- zip.writestr(name, content)
+ zip = zipfile.ZipFile(path, 'w')
+ zip.writestr(name, content)
+ zip.close()
return path
def test_single_script(self):