apache / arrow-adbc

Database connectivity API standard and libraries for Apache Arrow
https://arrow.apache.org/adbc/
Apache License 2.0
360 stars 89 forks source link

python/adbc_driver_manager: test_lowlevel.py::test_pycapsule failed with PyArrow >= 17 #2111

Closed kou closed 4 weeks ago

kou commented 4 weeks ago

What feature or improvement would you like to see?

../venv-source/lib/python3.12/site-packages/_pytest/python_api.py:1019: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ExceptionInfo ArrowInvalid('Cannot import released Arrow Stream') tblen=5>
regexp = 'Cannot import released ArrowArrayStream'

    def match(self, regexp: str | Pattern[str]) -> Literal[True]:
        """Check whether the regular expression `regexp` matches the string
        representation of the exception using :func:`python:re.search`.

        If it matches `True` is returned, otherwise an `AssertionError` is raised.
        """
        __tracebackhide__ = True
        value = self._stringify_exception(self.value)
        msg = f"Regex pattern did not match.\n Regex: {regexp!r}\n Input: {value!r}"
        if regexp == value:
            msg += "\n Did you mean to `re.escape()` the regex?"
>       assert re.search(regexp, value), msg
E       AssertionError: Regex pattern did not match.
E        Regex: 'Cannot import released ArrowArrayStream'
E        Input: 'Cannot import released Arrow Stream'

../venv-source/lib/python3.12/site-packages/_pytest/_code/code.py:722: AssertionError
=========================== short test summary info ============================
FAILED python/adbc_driver_manager/tests/test_lowlevel.py::test_pycapsule - AssertionError: Regex pattern did not match.
 Regex: 'Cannot import released ArrowArrayStream'
 Input: 'Cannot import released Arrow Stream'

https://github.com/apache/arrow-adbc/blob/cda3468e246c5ebbf615b69a83219d075ce78a47/python/adbc_driver_manager/tests/test_lowlevel.py#L457

uses ... ArrowArrayStream as the expected error message but https://github.com/apache/arrow/pull/40807/files#diff-8897de719613dfdec93c98eca5567d157a0848802cf8554959ca2ebdde3c6839L2329-R2448 (Hmm, we need to "Load diff" of bridge.cc explicitly) changed the error message. So the test works with PyArrow < 17 but doesn't work with PyArrow >= 17.

Can we relax the error message pattern or something to support both of old PyArrow and new PyArrow? Or we may be able to drop support for old PyArrow in our test.

lidavidm commented 4 weeks ago

We can relax the pattern

lidavidm commented 4 weeks ago

Ah, I had pinned pyarrow...let's try unpinning things

lidavidm commented 4 weeks ago

We should be better about testing different versions: https://github.com/apache/arrow-adbc/issues/2113