File tree Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Original file line number Diff line number Diff line change 4545. $FWDIR /bin/load-spark-env.sh
4646
4747# Figure out which Python executable to use
48- if [ -z " $PYSPARK_PYTHON " ] ; then
48+ if [[ -z " $PYSPARK_PYTHON " ]] ; then
4949 PYSPARK_PYTHON=" python"
5050fi
5151export PYSPARK_PYTHON
@@ -59,7 +59,7 @@ export OLD_PYTHONSTARTUP=$PYTHONSTARTUP
5959export PYTHONSTARTUP=$FWDIR /python/pyspark/shell.py
6060
6161# If IPython options are specified, assume user wants to run IPython
62- if [ -n " $IPYTHON_OPTS " ]; then
62+ if [[ -n " $IPYTHON_OPTS " ] ]; then
6363 IPYTHON=1
6464fi
6565
@@ -76,6 +76,16 @@ for i in "$@"; do
7676done
7777export PYSPARK_SUBMIT_ARGS
7878
79+ # For pyspark tests
80+ if [[ -n " $SPARK_TESTING " ]]; then
81+ if [[ -n " $PYSPARK_DOC_TEST " ]]; then
82+ exec " $PYSPARK_PYTHON " -m doctest $1
83+ else
84+ exec " $PYSPARK_PYTHON " $1
85+ fi
86+ exit
87+ fi
88+
7989# If a python file is provided, directly run spark-submit.
8090if [[ " $1 " =~ \. py$ ]]; then
8191 echo -e " \nWARNING: Running python applications through ./bin/pyspark is deprecated as of Spark 1.0." 1>&2
8696 if [[ " $IPYTHON " = " 1" ]]; then
8797 exec ipython $IPYTHON_OPTS
8898 else
89- if [[ -n $SPARK_TESTING ]]; then
90- exec " $PYSPARK_PYTHON " -m doctest
91- else
92- exec " $PYSPARK_PYTHON "
93- fi
99+ exec " $PYSPARK_PYTHON "
94100 fi
95101fi
Original file line number Diff line number Diff line change @@ -44,7 +44,6 @@ function run_test() {
4444 echo -en " \033[0m" # No color
4545 exit -1
4646 fi
47-
4847}
4948
5049echo " Running PySpark tests. Output is in python/unit-tests.log."
@@ -55,9 +54,11 @@ run_test "pyspark/conf.py"
5554if [ -n " $_RUN_SQL_TESTS " ]; then
5655 run_test " pyspark/sql.py"
5756fi
57+ export PYSPARK_DOC_TEST=1
5858run_test " pyspark/broadcast.py"
5959run_test " pyspark/accumulators.py"
6060run_test " pyspark/serializers.py"
61+ unset PYSPARK_DOC_TEST
6162run_test " pyspark/tests.py"
6263run_test " pyspark/mllib/_common.py"
6364run_test " pyspark/mllib/classification.py"
You can’t perform that action at this time.
0 commit comments