This is an automated email from the ASF dual-hosted git repository.

raulcd pushed a commit to branch maint-16.0.0
in repository https://gitbox.apache.org/repos/asf/arrow.git

commit e138bdc5f0178a57f13c445396b42aa3795a88c4
Author: Alenka Frim <[email protected]>
AuthorDate: Wed Apr 10 09:54:38 2024 +0200

    GH-41043: [CI][Python] check message in test_make_write_options_error for 
Cython 2 (#41059)
    
    ### Rationale for this change
    
    `test_make_write_options_error` has been failing on Cython 2 crossbow build 
because in older versions of Cython the methods were "regular" C extension 
method had type check automatically built in. In Cython 3 that is not the case, 
see https://github.com/cython/cython/issues/6127 and so the check for 
`ParquetFileFormat` was added in https://github.com/apache/arrow/pull/40976.
    
    ### What changes are included in this PR?
    
    Checking the error raised for both messages, type check and the check for 
`ParquetFileFormat` added in https://github.com/apache/arrow/pull/40976.
    
    ### Are these changes tested?
    
    Yes.
    
    ### Are there any user-facing changes?
    
    No.
    * GitHub Issue: #41043
    
    Authored-by: AlenkaF <[email protected]>
    Signed-off-by: Raúl Cumplido <[email protected]>
---
 python/pyarrow/tests/test_dataset.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/python/pyarrow/tests/test_dataset.py 
b/python/pyarrow/tests/test_dataset.py
index 6bba7240c0..0b79218fb0 100644
--- a/python/pyarrow/tests/test_dataset.py
+++ b/python/pyarrow/tests/test_dataset.py
@@ -5633,11 +5633,17 @@ def 
test_checksum_write_dataset_read_dataset_to_table(tempdir):
 
 
 def test_make_write_options_error():
-    # GH-39440
-    msg = ("make_write_options\\(\\) should be called on an "
-           "instance of ParquetFileFormat")
-    with pytest.raises(TypeError, match=msg):
+    # GH-39440: calling make_write_options as a static class method
+    msg_1 = ("make_write_options() should be called on an "
+             "instance of ParquetFileFormat")
+    # GH-41043: In Cython2 all Cython methods were "regular" C extension 
methods
+    # see: https://github.com/cython/cython/issues/6127#issuecomment-2038153359
+    msg_2 = ("descriptor 'make_write_options' for "
+             "'pyarrow._dataset_parquet.ParquetFileFormat' objects "
+             "doesn't apply to a 'int'")
+    with pytest.raises(TypeError) as excinfo:
         pa.dataset.ParquetFileFormat.make_write_options(43)
+    assert msg_1 in str(excinfo.value) or msg_2 in str(excinfo.value)
 
     pformat = pa.dataset.ParquetFileFormat()
     msg = "make_write_options\\(\\) takes exactly 0 positional arguments"

Reply via email to