Skip to content

Commit 8065797

Browse files
committed
[SPARK-52238][TESTS][FOLLOW-UP] Fix test failure in daily builds
### What changes were proposed in this pull request? python 3.12/3.13 were broken: ``` ====================================================================== ERROR [0.019s]: test_collect_blocked (__main__.BlockSparkConnectAccessTests.test_collect_blocked) ---------------------------------------------------------------------- Traceback (most recent call last): File "/__w/spark/spark/python/pyspark/pipelines/tests/test_block_connect_access.py", line 51, in test_collect_blocked self.assertEquals( ^^^^^^^^^^^^^^^^^ AttributeError: 'BlockSparkConnectAccessTests' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'? ====================================================================== ERROR [0.016s]: test_schema_access_blocked (__main__.BlockSparkConnectAccessTests.test_schema_access_blocked) ---------------------------------------------------------------------- Traceback (most recent call last): File "/__w/spark/spark/python/pyspark/pipelines/tests/test_block_connect_access.py", line 41, in test_schema_access_blocked self.assertEquals( ^^^^^^^^^^^^^^^^^ AttributeError: 'BlockSparkConnectAccessTests' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'? ---------------------------------------------------------------------- Ran 5 tests in 7.175s ``` ### Why are the changes needed? to make CI happy ### Does this PR introduce _any_ user-facing change? no, test-only ### How was this patch tested? PR build with ``` default: '{"PYSPARK_IMAGE_TO_TEST": "python-312", "PYTHON_TO_TEST": "python3.12"}' ``` https://github.com/zhengruifeng/spark/actions/runs/15407621295/job/43353257681 ### Was this patch authored or co-authored using generative AI tooling? no Closes #51067 from zhengruifeng/fix_assert_equals. Authored-by: Ruifeng Zheng <[email protected]> Signed-off-by: Ruifeng Zheng <[email protected]>
1 parent b18b956 commit 8065797

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

python/pyspark/pipelines/tests/test_block_connect_access.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def test_schema_access_blocked(self):
3838
with block_spark_connect_execution_and_analysis():
3939
with self.assertRaises(PySparkException) as context:
4040
df.schema
41-
self.assertEquals(
41+
self.assertEqual(
4242
context.exception.getCondition(), "ATTEMPT_ANALYSIS_IN_PIPELINE_QUERY_FUNCTION"
4343
)
4444

@@ -48,7 +48,7 @@ def test_collect_blocked(self):
4848
with block_spark_connect_execution_and_analysis():
4949
with self.assertRaises(PySparkException) as context:
5050
df.collect()
51-
self.assertEquals(
51+
self.assertEqual(
5252
context.exception.getCondition(), "ATTEMPT_ANALYSIS_IN_PIPELINE_QUERY_FUNCTION"
5353
)
5454

python/pyspark/pipelines/tests/test_decorators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ def test_decorator_with_positional_arg(self):
5555
with self.assertRaises(PySparkTypeError) as context:
5656
decorator("table1")
5757

58-
self.assertEquals(context.exception.getCondition(), "DECORATOR_ARGUMENT_NOT_CALLABLE")
58+
self.assertEqual(context.exception.getCondition(), "DECORATOR_ARGUMENT_NOT_CALLABLE")
5959
message_parameters = context.exception.getMessageParameters()
6060
assert message_parameters is not None
61-
self.assertEquals(message_parameters["decorator_name"], decorator.__name__)
61+
self.assertEqual(message_parameters["decorator_name"], decorator.__name__)
6262
assert message_parameters["example_usage"].startswith(f"@{decorator.__name__}(")
6363

6464

python/pyspark/pipelines/tests/test_graph_element_registry.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,41 +46,41 @@ def flow1():
4646
def flow2():
4747
raise NotImplementedError()
4848

49-
self.assertEquals(len(registry.datasets), 3)
50-
self.assertEquals(len(registry.flows), 4)
49+
self.assertEqual(len(registry.datasets), 3)
50+
self.assertEqual(len(registry.flows), 4)
5151

5252
mv_obj = registry.datasets[0]
53-
self.assertEquals(mv_obj.name, "mv")
53+
self.assertEqual(mv_obj.name, "mv")
5454
assert mv_obj.source_code_location.filename.endswith("test_graph_element_registry.py")
5555

5656
mv_flow_obj = registry.flows[0]
57-
self.assertEquals(mv_flow_obj.name, "mv")
58-
self.assertEquals(mv_flow_obj.target, "mv")
57+
self.assertEqual(mv_flow_obj.name, "mv")
58+
self.assertEqual(mv_flow_obj.target, "mv")
5959
assert mv_flow_obj.source_code_location.filename.endswith("test_graph_element_registry.py")
6060

6161
st_obj = registry.datasets[1]
62-
self.assertEquals(st_obj.name, "st")
62+
self.assertEqual(st_obj.name, "st")
6363
assert st_obj.source_code_location.filename.endswith("test_graph_element_registry.py")
6464

6565
st_flow_obj = registry.flows[1]
66-
self.assertEquals(st_flow_obj.name, "st")
67-
self.assertEquals(st_flow_obj.target, "st")
66+
self.assertEqual(st_flow_obj.name, "st")
67+
self.assertEqual(st_flow_obj.target, "st")
6868
assert mv_flow_obj.source_code_location.filename.endswith("test_graph_element_registry.py")
6969

7070
st2_obj = registry.datasets[2]
71-
self.assertEquals(st2_obj.name, "st2")
71+
self.assertEqual(st2_obj.name, "st2")
7272
assert st2_obj.source_code_location.filename.endswith("test_graph_element_registry.py")
7373

7474
st2_flow1_obj = registry.flows[2]
75-
self.assertEquals(st2_flow1_obj.name, "flow1")
76-
self.assertEquals(st2_flow1_obj.target, "st2")
77-
self.assertEquals(st2_flow1_obj.once, True)
75+
self.assertEqual(st2_flow1_obj.name, "flow1")
76+
self.assertEqual(st2_flow1_obj.target, "st2")
77+
self.assertEqual(st2_flow1_obj.once, True)
7878
assert mv_flow_obj.source_code_location.filename.endswith("test_graph_element_registry.py")
7979

8080
st2_flow1_obj = registry.flows[3]
81-
self.assertEquals(st2_flow1_obj.name, "flow2")
82-
self.assertEquals(st2_flow1_obj.target, "st2")
83-
self.assertEquals(st2_flow1_obj.once, False)
81+
self.assertEqual(st2_flow1_obj.name, "flow2")
82+
self.assertEqual(st2_flow1_obj.target, "st2")
83+
self.assertEqual(st2_flow1_obj.once, False)
8484
assert mv_flow_obj.source_code_location.filename.endswith("test_graph_element_registry.py")
8585

8686
def test_definition_without_graph_element_registry(self):
@@ -91,15 +91,15 @@ def test_definition_without_graph_element_registry(self):
9191
def a():
9292
raise NotImplementedError()
9393

94-
self.assertEquals(
94+
self.assertEqual(
9595
context.exception.getCondition(),
9696
"GRAPH_ELEMENT_DEFINED_OUTSIDE_OF_DECLARATIVE_PIPELINE",
9797
)
9898

9999
with self.assertRaises(PySparkException) as context:
100100
sdp.create_streaming_table("st")
101101

102-
self.assertEquals(
102+
self.assertEqual(
103103
context.exception.getCondition(),
104104
"GRAPH_ELEMENT_DEFINED_OUTSIDE_OF_DECLARATIVE_PIPELINE",
105105
)
@@ -110,7 +110,7 @@ def a():
110110
def b():
111111
raise NotImplementedError()
112112

113-
self.assertEquals(
113+
self.assertEqual(
114114
context.exception.getCondition(),
115115
"GRAPH_ELEMENT_DEFINED_OUTSIDE_OF_DECLARATIVE_PIPELINE",
116116
)

0 commit comments

Comments
 (0)