This is an automated email from the ASF dual-hosted git repository.
raulcd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new ac006a47545 GH-51446: [CI][Python] Fix test collection errors when
Parquet encryption is unavailable (#51457)
ac006a47545 is described below
commit ac006a47545ebb1150788f6891c24d4e21d4aa1a
Author: Adam Reeve <[email protected]>
AuthorDate: Tue Sep 22 23:46:40 2026 +1200
GH-51446: [CI][Python] Fix test collection errors when Parquet encryption
is unavailable (#51457)
### Rationale for this change
Fixes test collection failing in nightly builds that don't have Parquet
encryption enabled.
### What changes are included in this PR?
Don't reference `InMemoryKmsClient` in function signatures, it's not
defined if `pyarrow.parquet.encryption` can't be imported.
### Are these changes tested?
Yes, I reproduced the crash collecting tests without encryption enabled and
verified this is fixed, and also verified the tests still work with encryption
enabled.
### Are there any user-facing changes?
No
### Was AI used for this PR?
In accordance to the [AI generation
guidelines](https://arrow.apache.org/docs/dev/developers/overview.html#ai-generated-code),
please disclose below whether and how AI was used in this PR.
**PR code and description written by:**
- [x] Human
- [ ] AI
**Reviewed before submission by:**
- [x] Human
- [ ] AI
- [ ] Not reviewed
* GitHub Issue: #51446
Authored-by: Adam Reeve <[email protected]>
Signed-off-by: Raúl Cumplido <[email protected]>
---
python/pyarrow/tests/parquet/test_encryption.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/python/pyarrow/tests/parquet/test_encryption.py
b/python/pyarrow/tests/parquet/test_encryption.py
index 6d0cfc0024e..5185bf6a301 100644
--- a/python/pyarrow/tests/parquet/test_encryption.py
+++ b/python/pyarrow/tests/parquet/test_encryption.py
@@ -680,9 +680,12 @@ def test_external_key_material_rotation(
assert data_table.equals(table_read_after_rotation)
-def recording_kms_factory(created_configs, client_class=InMemoryKmsClient):
+def recording_kms_factory(created_configs, client_class=None):
"""Create a KMS client factory that appends the KMS instance ID and URL of
each connection configuration it is given to created_configs"""
+ if client_class is None:
+ client_class = InMemoryKmsClient
+
def kms_factory(kms_connection_configuration):
created_configs.append(
(kms_connection_configuration.kms_instance_id,