Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[SPARK-3867][PySpark] ./python/run-tests failed when it run with Pyth…
…on 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 <[email protected]>

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
  • Loading branch information
cocoatomo authored and Davies Liu committed Dec 10, 2014
commit bda1c721e1e691b77a0ba1fd4291278b6be42d6f
6 changes: 5 additions & 1 deletion python/pyspark/mllib/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
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

Expand Down
6 changes: 5 additions & 1 deletion python/pyspark/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
import zipfile

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

Expand Down