akashchamp commented on code in PR #51309:
URL: https://github.com/apache/arrow/pull/51309#discussion_r4056757796
##########
python/pyarrow/tests/test_dlpack.py:
##########
@@ -270,10 +270,11 @@ def immutable_tensor():
@pytest.mark.parametrize('max_version', [None, (0, 8)])
def test_dlpack_legacy_capsule_immutable_tensor(max_version):
tensor = immutable_tensor()
- with pytest.raises(NotImplementedError,
- match="Legacy DLPack support is not implemented "
- "for immutable tensors"):
- tensor.__dlpack__(max_version=max_version)
+ with pytest.warns(DeprecationWarning, match="unversioned DLPack capsule"):
+ with pytest.raises(NotImplementedError,
+ match="Legacy DLPack support is not implemented "
+ "for immutable tensors"):
+ tensor.__dlpack__(max_version=max_version)
Review Comment:
Good catch, this was our own code warning and then failing. I included the
fix here rather than a separate PR: in array.pxi and tensor.pxi the legacy
tensor is now created first and the DeprecationWarning is only emitted after
that succeeds, so the immutable tensor test is back to expecting just the
NotImplementedError.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]