Skip to content

Commit a2caf97

Browse files
committed
Update standalone tests
1 parent 219f017 commit a2caf97

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

python/pyspark/standalone_tests.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@
2525
import os
2626
import sys
2727

28-
from pyspark.sql import SparkSession
29-
30-
if 'numpy' in sys.modules:
31-
from pyspark.ml.param import Params
32-
from pyspark.mllib.linalg import *
33-
else:
34-
print("Skipping pyspark ml import tests, missing numpy")
3528

3629
if sys.version >= "3":
3730
from io import StringIO
@@ -41,12 +34,22 @@
4134
if __name__ == "__main__":
4235
gateway_already_started = "PYSPARK_GATEWAY_PORT" in os.environ
4336
if not gateway_already_started:
37+
print("redirecting stdout and stderr")
4438
_old_stdout = sys.stdout
4539
_old_stderr = sys.stderr
4640
# Verify stdout/stderr overwrite support for jupyter
4741
sys.stdout = new_stdout = StringIO()
4842
sys.stderr = new_stderr = StringIO()
4943

44+
45+
from pyspark.sql import SparkSession
46+
if 'numpy' in sys.modules:
47+
from pyspark.ml.param import Params
48+
from pyspark.mllib.linalg import *
49+
else:
50+
print("Skipping pyspark ml import tests, missing numpy")
51+
52+
5053
spark = SparkSession\
5154
.builder\
5255
.appName("PipSanityCheck")\
@@ -72,6 +75,7 @@
7275

7376
if logs.find("'str' object has no attribute 'startsWith'") == -1:
7477
print("Failed to find helpful error message, redirect failed?")
78+
print("logs were {0}".format(logs))
7579
sys.exit(-1)
7680
print("Successfully ran pip sanity check")
7781

0 commit comments

Comments
 (0)