Skip to content

Commit 3f0bd2f

Browse files
GH-45169: [Python] Adapt to modified pytest ignore collect hook api (#45170)
### Rationale for this change Prevent pytest from logging a warning during the unit tests and adapt to the future removal of the path argument in the `pytest_ignore_collect` hook. ### What changes are included in this PR? This changes the deprecated `path` argument in the pytest `pytest_ignore_collect` hook to `collection_path` which it should be as of pytest 7.0: https://docs.pytest.org/en/latest/deprecations.html#py-path-local-arguments-for-hooks-replaced-with-pathlib-path ### Are these changes tested? The existing tests keep on running without a deprecation warning being logged for this. ### Are there any user-facing changes? No * GitHub Issue: #45169 Authored-by: Rob Van Mieghem <[email protected]> Signed-off-by: Antoine Pitrou <[email protected]>
1 parent 2b5f56c commit 3f0bd2f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

python/pyarrow/conftest.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,10 @@
217217

218218

219219
# Doctest should ignore files for the modules that are not built
220-
def pytest_ignore_collect(path, config):
220+
def pytest_ignore_collect(collection_path, config):
221221
if config.option.doctestmodules:
222222
# don't try to run doctests on the /tests directory
223-
if "/pyarrow/tests/" in str(path):
223+
if "/pyarrow/tests/" in str(collection_path):
224224
return True
225225

226226
doctest_groups = [
@@ -233,32 +233,32 @@ def pytest_ignore_collect(path, config):
233233

234234
# handle cuda, flight, etc
235235
for group in doctest_groups:
236-
if 'pyarrow/{}'.format(group) in str(path):
236+
if 'pyarrow/{}'.format(group) in str(collection_path):
237237
if not defaults[group]:
238238
return True
239239

240-
if 'pyarrow/parquet/encryption' in str(path):
240+
if 'pyarrow/parquet/encryption' in str(collection_path):
241241
if not defaults['parquet_encryption']:
242242
return True
243243

244-
if 'pyarrow/cuda' in str(path):
244+
if 'pyarrow/cuda' in str(collection_path):
245245
try:
246246
import pyarrow.cuda # noqa
247247
return False
248248
except ImportError:
249249
return True
250250

251-
if 'pyarrow/fs' in str(path):
251+
if 'pyarrow/fs' in str(collection_path):
252252
try:
253253
from pyarrow.fs import S3FileSystem # noqa
254254
return False
255255
except ImportError:
256256
return True
257257

258258
if getattr(config.option, "doctest_cython", False):
259-
if "/pyarrow/tests/" in str(path):
259+
if "/pyarrow/tests/" in str(collection_path):
260260
return True
261-
if "/pyarrow/_parquet_encryption" in str(path):
261+
if "/pyarrow/_parquet_encryption" in str(collection_path):
262262
return True
263263

264264
return False

0 commit comments

Comments
 (0)