Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-46607][PYTHON][TESTS] Check the testing mode #44611

Closed
wants to merge 1 commit into from

Conversation

zhengruifeng
Copy link
Contributor

@zhengruifeng zhengruifeng commented Jan 5, 2024

What changes were proposed in this pull request?

1, check the testing mode:

  • test_assert_vanilla_mode in ReusedPySparkTestCase
  • test_assert_remote_mode in ReusedConnectTestCase

use different function names in case a test suite inherit them both

2, fix the incorrect testing mode introduced in #44196

Why are the changes needed?

incorrect usage of PandasOnSparkTestCase (subclass of ReusedPySparkTestCase) in parity tests cause test with vanilla Spark Session:
#44196
#44592

Does this PR introduce any user-facing change?

no

How was this patch tested?

ci, added UT

Was this patch authored or co-authored using generative AI tooling?

no

fix
@@ -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

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

@zhengruifeng
Copy link
Contributor Author

cc @HyukjinKwon and @itholic please take a look

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

@HyukjinKwon
Copy link
Member

Merged to master.

@zhengruifeng zhengruifeng deleted the py_testing_mode branch January 8, 2024 01:02
@zhengruifeng
Copy link
Contributor Author

thanks @HyukjinKwon and @itholic for reivews

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants