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

Tests fail on Pytest 7.2 with PytestDeprecationWarning in pytest-cov #682

Open
jaraco opened this issue Apr 16, 2024 · 1 comment
Open
Labels
bug Something is broken triage

Comments

@jaraco
Copy link
Member

jaraco commented Apr 16, 2024

When unpinning from pytest <7.2 to pytest < 7.3, the tests fail with this error:

 cheroot bugfix/511-unpin-pytest @ tox -e py311
py311: recreate env because requirements removed: pytest<7.2,>=7
py311: remove tox env folder /Users/jaraco/code/cherrypy/cheroot/.tox/py311
py311: install_deps> .tox/py311/bin/python -bb -E -s /Users/jaraco/code/cherrypy/cheroot/bin/pip-wrapper py311 /Users/jaraco/code/cherrypy/cheroot/requirements/ install -r requirements/tests.in
.pkg-cpython311: _optional_hooks> python '/Users/jaraco/Library/Application Support/pipx/venvs/tox/lib/python3.12/site-packages/pyproject_api/_backend.py' True setuptools.build_meta
.pkg-cpython311: get_requires_for_build_editable> python '/Users/jaraco/Library/Application Support/pipx/venvs/tox/lib/python3.12/site-packages/pyproject_api/_backend.py' True setuptools.build_meta
.pkg-cpython311: build_editable> python '/Users/jaraco/Library/Application Support/pipx/venvs/tox/lib/python3.12/site-packages/pyproject_api/_backend.py' True setuptools.build_meta
py311: install_package_deps> .tox/py311/bin/python -bb -E -s /Users/jaraco/code/cherrypy/cheroot/bin/pip-wrapper py311 /Users/jaraco/code/cherrypy/cheroot/requirements/ install 'importlib-metadata; python_version < "3.8"' jaraco.functools 'more-itertools>=2.6'
py311: install_package> .tox/py311/bin/python -bb -E -s /Users/jaraco/code/cherrypy/cheroot/bin/pip-wrapper py311 /Users/jaraco/code/cherrypy/cheroot/requirements/ install --force-reinstall --no-deps /Users/jaraco/code/cherrypy/cheroot/.tox/.tmp/package/10/cheroot-11.0.0b1.dev28+g801f3761.d20240416-0.editable-py3-none-any.whl
py311: commands_pre[0]> .tox/py311/bin/python -bb -E -s -m OpenSSL.debug
pyOpenSSL: 24.1.0
cryptography: 42.0.5
cffi: 1.16.0
cryptography's compiled against OpenSSL: OpenSSL 3.2.1 30 Jan 2024
cryptography's linked OpenSSL: OpenSSL 3.2.1 30 Jan 2024
Python's OpenSSL: OpenSSL 3.2.1 30 Jan 2024
Python executable: /Users/jaraco/code/cherrypy/cheroot/.tox/py311/bin/python
Python version: 3.11.8 (main, Feb  6 2024, 21:21:21) [Clang 15.0.0 (clang-1500.1.0.2.5)]
Platform: darwin
sys.path: ['/Users/jaraco/code/cherrypy/cheroot', '/opt/homebrew/Cellar/[email protected]/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python311.zip', '/opt/homebrew/Cellar/[email protected]/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11', '/opt/homebrew/Cellar/[email protected]/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload', '/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages']
py311: commands[0]> .tox/py311/bin/python -bb -E -s -m pytest --color=yes
/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/_pytest/config/__init__.py:329: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
Plugin: helpconfig, Hook: pytest_cmdline_parse
PytestDeprecationWarning: The hookimpl CovPlugin.pytest_configure_node uses old-style configuration options (marks or attributes).
Please use the pytest.hookimpl(optionalhook=True) decorator instead
 to configure the hooks.
 See https://docs.pytest.org/en/latest/deprecations.html#configuring-hook-specs-impls-using-markers
 at /Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/pytest_cov/plugin.py:233
For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
  config = pluginmanager.hook.pytest_cmdline_parse(
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/pytest/__main__.py", line 5, in <module>
    raise SystemExit(pytest.console_main())
                     ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/_pytest/config/__init__.py", line 190, in console_main
    code = main()
           ^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/_pytest/config/__init__.py", line 148, in main
    config = _prepareconfig(args, plugins)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/_pytest/config/__init__.py", line 329, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/pluggy/_hooks.py", line 501, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/pluggy/_manager.py", line 119, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/pluggy/_callers.py", line 155, in _multicall
    teardown[0].send(outcome)
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/_pytest/helpconfig.py", line 103, in pytest_cmdline_parse
    config: Config = outcome.get_result()
                     ^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/pluggy/_result.py", line 99, in get_result
    raise exc.with_traceback(exc.__traceback__)
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/pluggy/_callers.py", line 102, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/_pytest/config/__init__.py", line 1060, in pytest_cmdline_parse
    self.parse(args)
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/_pytest/config/__init__.py", line 1348, in parse
    self._preparse(args, addopts=addopts)
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/_pytest/config/__init__.py", line 1250, in _preparse
    self.hook.pytest_load_initial_conftests(
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/pluggy/_hooks.py", line 501, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/pluggy/_manager.py", line 119, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/pluggy/_callers.py", line 181, in _multicall
    return outcome.get_result()
           ^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/pluggy/_result.py", line 99, in get_result
    raise exc.with_traceback(exc.__traceback__)
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/pluggy/_callers.py", line 102, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/pytest_cov/plugin.py", line 127, in pytest_load_initial_conftests
    early_config.pluginmanager.register(plugin, '_cov')
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/_pytest/config/__init__.py", line 489, in register
    ret: Optional[str] = super().register(plugin, name)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/pluggy/_manager.py", line 156, in register
    hookimpl_opts = self.parse_hookimpl_opts(plugin, name)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/_pytest/config/__init__.py", line 460, in parse_hookimpl_opts
    return _get_legacy_hook_marks(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/_pytest/config/__init__.py", line 374, in _get_legacy_hook_marks
    warn_explicit_for(cast(FunctionType, method), message)
  File "/Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/_pytest/warning_types.py", line 171, in warn_explicit_for
    raise type(w)(f"{w}\n at {filename}:{lineno}") from None
pytest.PytestDeprecationWarning: The hookimpl CovPlugin.pytest_configure_node uses old-style configuration options (marks or attributes).
Please use the pytest.hookimpl(optionalhook=True) decorator instead
 to configure the hooks.
 See https://docs.pytest.org/en/latest/deprecations.html#configuring-hook-specs-impls-using-markers
 at /Users/jaraco/code/cherrypy/cheroot/.tox/py311/lib/python3.11/site-packages/pytest_cov/plugin.py:233
py311: exit 1 (0.25 seconds) /Users/jaraco/code/cherrypy/cheroot> .tox/py311/bin/python -bb -E -s -m pytest --color=yes pid=35888
  py311: FAIL code 1 (6.72=setup[6.14]+cmd[0.33,0.25] seconds)
  evaluation failed :( (6.77 seconds)
@jaraco jaraco added bug Something is broken triage labels Apr 16, 2024
@webknjaz
Copy link
Member

pytest-cov is also pinned: https://github.com/cherrypy/cheroot/blob/86cb5ba/requirements/tests.in#L36. I don't remember why, though. But it was back when Python 2 was still in the matrix so that might've been the reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken triage
Projects
None yet
Development

No branches or pull requests

2 participants