domdfcoding / consolekit

Additional utilities for click.
https://consolekit.readthedocs.io/en/latest
MIT License
8 stars 2 forks source link

1.7.0: pytest.PytestRemovedIn9Warning: The (path: py.path.local) argument is deprecated, please use (file_path: pathlib.Path) #104

Closed mtelka closed 3 months ago

mtelka commented 3 months ago

Description

Testing fails to start with the pytest.PytestRemovedIn9Warning: The (path: py.path.local) argument is deprecated, please use (file_path: pathlib.Path) message.

Steps to Reproduce

$ wget https://github.com/domdfcoding/consolekit/archive/refs/tags/v1.7.0.tar.gz
$ gtar xf v1.7.0.tar.gz
$ cd consolekit-1.7.0/
$ tox -e py39

Actual result:

ROOT: will run in automatically provisioned tox, host /usr/bin/python3.9 is missing [requires (has)]: tox-envlist>=0.2.1, tox~=3.0 (4.16.0)
ROOT: install_deps> python -I -m pip install 'pip!=22.2,>=21' tox 'tox-envlist>=0.2.1' 'tox~=3.0' 'virtualenv!=20.16.0'
ROOT: provision> .tox/.tox/bin/python -m tox -e py39
.package create: /tmp/test/consolekit-1.7.0/.tox/.package
.package installdeps: flit-core<4,>=3.2
py39 create: /tmp/test/consolekit-1.7.0/.tox/py39
py39 installdeps: -r/tmp/test/consolekit-1.7.0/tests/requirements.txt
py39 inst: /tmp/test/consolekit-1.7.0/.tox/.tmp/package/1/consolekit-1.7.0.tar.gz
py39 installed: backports.entry-points-selectable==1.3.0,chevron==0.14.0,click==8.1.7,coincidence==0.6.6,consolekit @ file:///tmp/test/consolekit-1.7.0/.tox/.tmp/package/1/consolekit-1.7.0.tar.gz#sha256=241530d2d11ca5cc46e1bc79799113d373b99bb8ed37271b969c2cc71a5a8e2f,coverage==7.6.0,coverage-pyver-pragma==0.3.3,decorator==5.1.1,deprecation==2.1.0,deprecation-alias==0.3.3,domdf-python-tools==3.9.0,exceptiongroup==1.2.2,importlib_metadata==8.1.0,iniconfig==2.0.0,mistletoe==1.4.0,mypy==0.971,mypy-extensions==1.0.0,natsort==8.4.0,packaging==24.1,pluggy==1.5.0,psutil==6.0.0,pyparsing==3.1.2,pytest==8.3.1,pytest-cov==5.0.0,pytest-datadir==1.5.0,pytest-mypy-plugins==1.11.1,pytest-randomly==3.15.0,pytest-regressions==2.5.0,pytest-timeout==2.3.1,PyYAML==6.0.1,regex==2024.5.15,tomli==2.0.1,typing_extensions==4.12.2,zipp==3.19.2
py39 run-test-pre: PYTHONHASHSEED='293226026'
py39 run-test: commands[0] | python --version
Python 3.9.19
py39 run-test: commands[1] | python -m pytest --cov=consolekit -r aR tests/
Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/pytest/__main__.py", line 9, in <module>
    raise SystemExit(pytest.console_main())
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/_pytest/config/__init__.py", line 201, in console_main
    code = main()
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/_pytest/config/__init__.py", line 156, in main
    config = _prepareconfig(args, plugins)
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/_pytest/config/__init__.py", line 341, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/pluggy/_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/pluggy/_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/_pytest/helpconfig.py", line 103, in pytest_cmdline_parse
    @pytest.hookimpl(wrapper=True)
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1140, in pytest_cmdline_parse
    self.parse(args)
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1490, in parse
    self._preparse(args, addopts=addopts) 
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1394, in _preparse
    self.hook.pytest_load_initial_conftests(
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/pluggy/_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/pluggy/_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/_pytest/warnings.py", line 144, in pytest_load_initial_conftests
    @pytest.hookimpl(wrapper=True)
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/pluggy/_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/_pytest/capture.py", line 137, in pytest_load_initial_conftests
    @hookimpl(wrapper=True)
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1218, in pytest_load_initial_conftests
    self.pluginmanager._set_initial_conftests(
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/_pytest/config/__init__.py", line 581, in _set_initial_conftests
    self._try_load_conftest(
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/_pytest/config/__init__.py", line 619, in _try_load_conftest
    self._loadconftestmodules(
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/_pytest/config/__init__.py", line 659, in _loadconftestmodules
    mod = self._importconftest(
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/_pytest/config/__init__.py", line 735, in _importconftest
    self.consider_conftest(mod, registration_name=conftestpath_plugin_name)
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/_pytest/config/__init__.py", line 816, in consider_conftest
    self.register(conftestmodule, name=registration_name)
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/_pytest/config/__init__.py", line 501, in register
    plugin_name = super().register(plugin, name)
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/pluggy/_manager.py", line 168, in register
    self._verify_hook(hook, hookimpl)
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/pluggy/_manager.py", line 360, in _verify_hook
    _warn_for_function(argname_warning, hookimpl.function)
  File "/tmp/test/consolekit-1.7.0/.tox/py39/lib/python3.9/site-packages/pluggy/_manager.py", line 41, in _warn_for_function
    warnings.warn_explicit(
pytest.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
ERROR: InvocationError for command /tmp/test/consolekit-1.7.0/.tox/py39/bin/python -m pytest --cov=consolekit -r aR tests/ (exited with code 1)
____________________________________________________________________________________________________________________ summary ____________________________________________________________________________________________________________________
ERROR:   py39: commands failed

Expected result:

Testing starts.

Reproduces how often:

Easily reproduced

Version

Installation source

GitHub Releases

Other Additional Information:

mtelka commented 3 months ago

This is fixed in 1.7.1 (via https://github.com/domdfcoding/consolekit/commit/5df2fb31d51c56f9b18fe0fce33329d4b260263d).