diff options
author | cocoatomo <cocoatomo77@gmail.com> | 2014-10-11 11:26:17 -0700 |
---|---|---|
committer | Josh Rosen <joshrosen@apache.org> | 2014-10-11 11:26:17 -0700 |
commit | 81015a2ba49583d730ce65b2262f50f1f2451a79 (patch) | |
tree | 1e8249392a30ab831348dd5b27ae06b72e5e0cc4 /python/pyspark/tests.py | |
parent | 0e8203f4fb721158fb27897680da476174d24c4b (diff) | |
download | spark-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/tests.py')
-rw-r--r-- | python/pyspark/tests.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/python/pyspark/tests.py b/python/pyspark/tests.py index 7f05d48ade..ceab57464f 100644 --- a/python/pyspark/tests.py +++ b/python/pyspark/tests.py @@ -34,7 +34,11 @@ import random from platform import python_implementation 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 |