Skip to content
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@

from pyspark.pandas.tests.groupby.test_grouping import GroupingTestsMixin
from pyspark.testing.connectutils import ReusedConnectTestCase
from pyspark.testing.pandasutils import PandasOnSparkTestCase
from pyspark.testing.pandasutils import PandasOnSparkTestUtils
Copy link
Contributor Author

@zhengruifeng zhengruifeng Jan 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

manually check that, before this fix this test suite fails with

  test_getitem (pyspark.pandas.tests.connect.groupby.test_parity_grouping.GroupingParityTests.test_getitem) ... ok (0.022s)
  test_assert_vanilla_mode (pyspark.testing.pandasutils.PandasOnSparkTestCase.test_assert_vanilla_mode) ... ok (0.000s)
  test_assert_remote_mode (pyspark.testing.connectutils.ReusedConnectTestCase.test_assert_remote_mode) ... ok (0.000s)

======================================================================
FAIL [0.003s]: test_assert_remote_mode (pyspark.pandas.tests.connect.groupby.test_parity_grouping.GroupingParityTests.test_assert_remote_mode)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/ruifeng.zheng/Dev/spark/python/pyspark/testing/connectutils.py", line 199, in test_assert_remote_mode
    self.assertTrue(is_remote())
AssertionError: False is not true

----------------------------------------------------------------------
Ran 6 tests in 8.455s



class GroupingParityTests(GroupingTestsMixin, PandasOnSparkTestCase, ReusedConnectTestCase):
class GroupingParityTests(
GroupingTestsMixin,
PandasOnSparkTestUtils,
ReusedConnectTestCase,
):
pass


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@

from pyspark.pandas.tests.groupby.test_missing import MissingTestsMixin
from pyspark.testing.connectutils import ReusedConnectTestCase
from pyspark.testing.pandasutils import PandasOnSparkTestCase
from pyspark.testing.pandasutils import PandasOnSparkTestUtils


class MissingParityTests(MissingTestsMixin, PandasOnSparkTestCase, ReusedConnectTestCase):
class MissingParityTests(
MissingTestsMixin,
PandasOnSparkTestUtils,
ReusedConnectTestCase,
):
pass


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@

from pyspark.pandas.tests.groupby.test_nlargest_nsmallest import NlargestNsmallestTestsMixin
from pyspark.testing.connectutils import ReusedConnectTestCase
from pyspark.testing.pandasutils import PandasOnSparkTestCase
from pyspark.testing.pandasutils import PandasOnSparkTestUtils


class NlargestNsmallestParityTests(
NlargestNsmallestTestsMixin, PandasOnSparkTestCase, ReusedConnectTestCase
NlargestNsmallestTestsMixin,
PandasOnSparkTestUtils,
ReusedConnectTestCase,
):
pass

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@

from pyspark.pandas.tests.groupby.test_raises import RaisesTestsMixin
from pyspark.testing.connectutils import ReusedConnectTestCase
from pyspark.testing.pandasutils import PandasOnSparkTestCase
from pyspark.testing.pandasutils import PandasOnSparkTestUtils


class RaisesParityTests(RaisesTestsMixin, PandasOnSparkTestCase, ReusedConnectTestCase):
class RaisesParityTests(
RaisesTestsMixin,
PandasOnSparkTestUtils,
ReusedConnectTestCase,
):
pass


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@

from pyspark.pandas.tests.groupby.test_rank import RankTestsMixin
from pyspark.testing.connectutils import ReusedConnectTestCase
from pyspark.testing.pandasutils import PandasOnSparkTestCase
from pyspark.testing.pandasutils import PandasOnSparkTestUtils


class RankParityTests(RankTestsMixin, PandasOnSparkTestCase, ReusedConnectTestCase):
class RankParityTests(
RankTestsMixin,
PandasOnSparkTestUtils,
ReusedConnectTestCase,
):
pass


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@

from pyspark.pandas.tests.groupby.test_size import SizeTestsMixin
from pyspark.testing.connectutils import ReusedConnectTestCase
from pyspark.testing.pandasutils import PandasOnSparkTestCase
from pyspark.testing.pandasutils import PandasOnSparkTestUtils


class SizeParityTests(SizeTestsMixin, PandasOnSparkTestCase, ReusedConnectTestCase):
class SizeParityTests(
SizeTestsMixin,
PandasOnSparkTestUtils,
ReusedConnectTestCase,
):
pass


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@

from pyspark.pandas.tests.groupby.test_value_counts import ValueCountsTestsMixin
from pyspark.testing.connectutils import ReusedConnectTestCase
from pyspark.testing.pandasutils import PandasOnSparkTestCase
from pyspark.testing.pandasutils import PandasOnSparkTestUtils


class ValueCountsParityTests(ValueCountsTestsMixin, PandasOnSparkTestCase, ReusedConnectTestCase):
class ValueCountsParityTests(
ValueCountsTestsMixin,
PandasOnSparkTestUtils,
ReusedConnectTestCase,
):
pass


Expand Down
5 changes: 5 additions & 0 deletions python/pyspark/testing/connectutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,8 @@ def setUpClass(cls):
def tearDownClass(cls):
shutil.rmtree(cls.tempdir.name, ignore_errors=True)
cls.spark.stop()

def test_assert_remote_mode(self):
from pyspark.sql import is_remote

self.assertTrue(is_remote())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

5 changes: 5 additions & 0 deletions python/pyspark/testing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ def setUpClass(cls):
def tearDownClass(cls):
cls.sc.stop()

def test_assert_vanilla_mode(self):
from pyspark.sql import is_remote

self.assertFalse(is_remote())


class ByteArrayOutput:
def __init__(self):
Expand Down