Skip to content

Commit c137e1c

Browse files
authored
Update pytest_collect_file hook to remove deprecated path argument (#112)
Replaced the deprecated `path` argument with `file_path: pathlib.Path` in the `pytest_collect_file` hook to address PytestRemovedIn9Warning. ``` tests/test_pytest_pycodestyle.py: 10 warnings /home/runner/work/pytest-pycodestyle/pytest-pycodestyle/src/pytest_pycodestyle.py:22: PytestRemovedIn9Warning: The (path: py.path.local) argument is deprecated, please use (file_path: pathlib.Path) see https://docs.pytest.org/en/latest/deprecations.html#py-path-local-arguments-for-hooks-replaced-with-pathlib-path def pytest_collect_file(file_path: pathlib.Path, path, parent): -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ```
1 parent fa1ffb6 commit c137e1c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pytest_pycodestyle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ def pytest_configure(config):
1919
config.addinivalue_line('markers', 'pycodestyle: mark tests to be checked by pycodestyle.')
2020

2121

22-
def pytest_collect_file(file_path: pathlib.Path, path, parent):
22+
def pytest_collect_file(file_path: pathlib.Path, parent):
2323
"""Create a Collector for the given path, or None if not relevant.
2424
2525
See:
26-
- https://docs.pytest.org/en/7.0.x/reference/reference.html#pytest.hookspec.pytest_collect_file
26+
- https://docs.pytest.org/en/8.3.x/reference/reference.html#pytest.hookspec.pytest_collect_file
2727
"""
2828
config = parent.config
2929
if config.getoption('pycodestyle') and file_path.suffix == '.py':

0 commit comments

Comments
 (0)