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

coverage broken with pytest 7.2.0 #17740

Open
mpcusack-color opened this issue Dec 7, 2022 · 4 comments
Open

coverage broken with pytest 7.2.0 #17740

mpcusack-color opened this issue Dec 7, 2022 · 4 comments
Labels
backend: Python Python backend-related issues bug

Comments

@mpcusack-color
Copy link

mpcusack-color commented Dec 7, 2022

Describe the bug
We recently upgraded to pytest==7.2.0 and noticed we can no longer use test --use-coverage.

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 /home/mpcusack/.cache/pants/named_caches/pex_root/venvs/s/4ea0b489/venv/lib/python3.8/site-packages/pytest_cov/plugin.py:256

https://docs.pytest.org/en/7.2.x/changelog.html#pytest-7-2-0-2022-10-23 deprecated a hook style in pytest-dev/pytest#4562. This wasn't adopted in pytest-cov until 4.0.0 https://pytest-cov.readthedocs.io/en/latest/changelog.html#id1

Pants hardcodes the pytest-cov version less than 3.1:

default_extra_requirements = ["pytest-cov>=2.12,!=2.12.1,<3.1", "pytest-xdist>=2.5,<3"]

Pants version
2.15.0a1

OS
Linux

@mpcusack-color
Copy link
Author

Oh I was using extra_requirements.add. I guess I can override with extra_requirements.

@tdyas tdyas added the backend: Python Python backend-related issues label Dec 10, 2022
@Eric-Arellano
Copy link
Contributor

Did that fix it? Still, we probablly should update the default versions of these tools to be newer

@mpcusack-color
Copy link
Author

The override fixes it. +1 to updating the default version.

@Eric-Arellano
Copy link
Contributor

+1 to updating the default version.

PR would be welcomed if you get a chance. You'd bump this:

default_extra_requirements = ["pytest-cov>=2.12,!=2.12.1,<3.1", "pytest-xdist>=2.5,<3"]

And then run build-support/bin/generate_all_lockfiles.sh --tool pytest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: Python Python backend-related issues bug
Projects
None yet
Development

No branches or pull requests

3 participants