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

Fix ament_get_pytest_cov_version for newer versions of pytest #315

Conversation

christophebedard
Copy link
Contributor

Newer versions of pytest do not display plugin versions by default. They require providing the --version option twice. See pytest-dev/pytest#7169.

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

It also works fine on older versions (using sudo here to use the version installed from apt).

$ sudo python3 -m pytest --version
This is pytest version 4.6.9, imported from /usr/lib/python3/dist-packages/pytest.py
setuptools registered plugins:
  pytest-cov-2.8.1 at /usr/lib/python3/dist-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
$ sudo python3 -m pytest --version --version
This is pytest version 4.6.9, imported from /usr/lib/python3/dist-packages/pytest.py
setuptools registered plugins:
  pytest-cov-2.8.1 at /usr/lib/python3/dist-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

Finally, fix version regex for pytest-cov.

Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com>
Copy link
Contributor

@hidmic hidmic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending green CI up to tracetools_test:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@clalancette clalancette merged commit 5730e2e into ament:master Jan 4, 2021
@christophebedard christophebedard deleted the fix-ament-get-pytest-cov-version-for-newer-pytest-versions branch January 4, 2021 16:19
mpavezb pushed a commit to DeepX-inc/ament_cmake that referenced this pull request Aug 20, 2021
)

Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants