Skip to content
Closed
Changes from all commits
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
8 changes: 6 additions & 2 deletions python/pyspark/testing/connectutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
have_googleapis_common_protos = googleapis_common_protos_requirement_message is None

from pyspark import Row, SparkConf
from pyspark.util import is_remote_only
from pyspark.testing.utils import PySparkErrorTestUtils
from pyspark.testing.sqlutils import (
have_pandas,
Expand Down Expand Up @@ -184,7 +185,9 @@ def setUpClass(cls):
.remote(cls.master())
.getOrCreate()
)
cls._legacy_sc = PySparkSession._instantiatedSession._sc
cls._legacy_sc = None
if not is_remote_only():
cls._legacy_sc = PySparkSession._instantiatedSession._sc
cls.tempdir = tempfile.NamedTemporaryFile(delete=False)
os.unlink(cls.tempdir.name)
cls.testData = [Row(key=i, value=str(i)) for i in range(100)]
Expand All @@ -203,4 +206,5 @@ def test_assert_remote_mode(self):
def quiet(self):
from pyspark.testing.utils import QuietTest

return QuietTest(self._legacy_sc)
if self._legacy_sc is not None:
return QuietTest(self._legacy_sc)