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

pytest_cov.__version__ string is broken on >=2.10.1 #468

Closed
christophebedard opened this issue May 13, 2021 · 6 comments
Closed

pytest_cov.__version__ string is broken on >=2.10.1 #468

christophebedard opened this issue May 13, 2021 · 6 comments
Labels

Comments

@christophebedard
Copy link

christophebedard commented May 13, 2021

Summary

Expected vs actual result

I expect pytest_cov.__version__ == 'x.y.z', but as of 2.10.1 it's pytest_cov.__version__ == "__version__ = 'x.y.z'": da61b91#diff-cfb899e3f5cac1afba8f5bafcd74392faf2677836ed2f3b068217df610ea6e82R2

This broke code that relied on the version string. There's no explanation in the CHANGELOG:

pytest-cov/CHANGELOG.rst

Lines 36 to 42 in 2cd0094

2.10.1 (2020-08-14)
-------------------
* Support for ``pytest-xdist`` 2.0, which breaks compatibility with ``pytest-xdist`` before 1.22.3 (from 2017).
Contributed by Zac Hatfield-Dodds in `#412 <https://github.com/pytest-dev/pytest-cov/pull/412>`_.
* Fixed the ``LocalPath has no attribute startswith`` failure that occurred when using the ``pytester`` plugin
in inline mode.

Looking at PEP 396 I'm not sure this is valid: https://www.python.org/dev/peps/pep-0396/#id27

Reproducer

Versions

Output of relevant packages pip list, python --version, pytest --version etc.

$ python3 --version
Python 3.8.5
$ pytest --version
pytest 6.2.2
$ pytest --version --version
This is pytest version 6.2.2, imported from /home/chris/.local/lib/python3.8/site-packages/pytest/__init__.py
setuptools registered plugins:
  pytest-rerunfailures-9.1.1 at /home/chris/.local/lib/python3.8/site-packages/pytest_rerunfailures.py
  pytest-repeat-0.9.1 at /home/chris/.local/lib/python3.8/site-packages/pytest_repeat.py
  pytest-cov-2.11.1 at /home/chris/.local/lib/python3.8/site-packages/pytest_cov/plugin.py
  colcon-core-0.6.1 at /usr/lib/python3/dist-packages/colcon_core/pytest/hooks.py
  pytest-mock-1.10.4 at /usr/lib/python3/dist-packages/pytest_mock.py

Config

N/A

Code

>>> from pkg_resources import parse_version
>>> from pytest_cov import __version__ as pytest_cov_version
>>> pytest_cov_version
"__version__ = '2.11.1'"
>>> parse_version('2.11.1') >= parse_version('2.5.0')
True
>>> parse_version(pytest_cov_version) >= parse_version('2.5.0')
False
@christophebedard
Copy link
Author

christophebedard commented May 13, 2021

Assuming this was not intentional, I think this might be caused by a tooling bug. A few commits before 2.10.1 was tagged, this config file here for bumping the version number was changed: https://github.com/pytest-dev/pytest-cov/pull/420/files#diff-9ea6e1e3dde6d4a7e08c7c88eceed69ca745d0d2c779f8f85219b22266efff7f (c4b0722).

I'll try to fix it.

@ionelmc
Copy link
Member

ionelmc commented May 13, 2021

An unfortunate consequence of me using old bumpversion and messing up the quotes :-(

@christophebedard
Copy link
Author

😆 thanks for fixing it!

@dirk-thomas
Copy link

Thanks for addressing this. Will there a new patch release with this fix in the near future?

@ionelmc
Copy link
Member

ionelmc commented May 14, 2021

Yes, yes. Gonna sort it out this week.

@ionelmc
Copy link
Member

ionelmc commented May 14, 2021

Just released 2.12

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

Successfully merging a pull request may close this issue.

4 participants