Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] Deprecated pytest collect hook argument logs a warning #45169

Closed
robvanmieghem opened this issue Jan 4, 2025 · 1 comment
Closed

Comments

@robvanmieghem
Copy link
Contributor

robvanmieghem commented Jan 4, 2025

Describe the bug, including details regarding any error messages.

When executing the python tests, pytest raises a deprecation warning:

pyarrow/conftest.py:220
  .../apache/arrow/python/pyarrow/conftest.py:220: PytestRemovedIn9Warning: The (path: py.path.local) argument is deprecated, please use (collection_path: pathlib.Path)
  see https://docs.pytest.org/en/latest/deprecations.html#py-path-local-arguments-for-hooks-replaced-with-pathlib-path
    def pytest_ignore_collect(path, config):

The path argument has been deprecated since pytest 7.0 and is scheduled for removal in pytest 9:
https://docs.pytest.org/en/latest/deprecations.html#py-path-local-arguments-for-hooks-replaced-with-pathlib-path

Component(s)

Python

pitrou pushed a commit that referenced this issue Jan 9, 2025
…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]>
@pitrou
Copy link
Member

pitrou commented Jan 9, 2025

Issue resolved by pull request 45170
#45170

@pitrou pitrou added this to the 20.0.0 milestone Jan 9, 2025
@pitrou pitrou closed this as completed Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants