aboutsummaryrefslogtreecommitdiff
path: root/python/pyspark/mllib
diff options
context:
space:
mode:
authorcocoatomo <cocoatomo77@gmail.com>2014-10-11 11:26:17 -0700
committerJosh Rosen <joshrosen@apache.org>2014-10-11 11:26:17 -0700
commit81015a2ba49583d730ce65b2262f50f1f2451a79 (patch)
tree1e8249392a30ab831348dd5b27ae06b72e5e0cc4 /python/pyspark/mllib
parent0e8203f4fb721158fb27897680da476174d24c4b (diff)
downloadspark-81015a2ba49583d730ce65b2262f50f1f2451a79.tar.gz
spark-81015a2ba49583d730ce65b2262f50f1f2451a79.tar.bz2
spark-81015a2ba49583d730ce65b2262f50f1f2451a79.zip
[SPARK-3867][PySpark] ./python/run-tests failed when it run with Python 2.6 and unittest2 is not installed
./python/run-tests search a Python 2.6 executable on PATH and use it if available. When using Python 2.6, it is going to import unittest2 module which is not a standard library in Python 2.6, so it fails with ImportError. Author: cocoatomo <cocoatomo77@gmail.com> Closes #2759 from cocoatomo/issues/3867-unittest2-import-error and squashes the following commits: f068eb5 [cocoatomo] [SPARK-3867] ./python/run-tests failed when it run with Python 2.6 and unittest2 is not installed
Diffstat (limited to 'python/pyspark/mllib')
-rw-r--r--python/pyspark/mllib/tests.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/python/pyspark/mllib/tests.py b/python/pyspark/mllib/tests.py
index 5c20e100e1..463faf7b6f 100644
--- a/python/pyspark/mllib/tests.py
+++ b/python/pyspark/mllib/tests.py
@@ -25,7 +25,11 @@ import array as pyarray
from numpy import array, array_equal
if sys.version_info[:2] <= (2, 6):
- import unittest2 as unittest
+ try:
+ import unittest2 as unittest
+ except ImportError:
+ sys.stderr.write('Please install unittest2 to test with Python 2.6 or earlier')
+ sys.exit(1)
else:
import unittest