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: Collect code coverage in multiple workers too #4451

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

echoix
Copy link
Member

@echoix echoix commented Oct 5, 2024

This PR adds code coverage collection to more tests, by enabling it for the tests ran with pytest-xdist (multiple workers in parallel).

The change in utils/coverage_mapper.py was needed to fix a situation where a file would end in .py.py if it already had an extension. It will happen primarily on Windows, but that part isn't ready yet as the time increase was a bit too big, and xdist wasn't working as well as I hoped yet. Also, macOS wasn't changed to include coverage yet since last time I tried, I had some issues with uploading the code coverage, and didn't retry recently with the new release of the codecov uploader. So it isn't ready there too.

In order to save up a couple dozen seconds here and there, I also ignored the gui/wxpython subfolders, as no coverage is collected now for it, and there is only one or two tests that could one day have coverage if it worked with gunittest. It will be reconsidered later.

$ ag -g 'gui/.*/test'
gui/wxpython/core/testsuite/data/test_toolboxes_menu.xml
gui/wxpython/core/testsuite/data/test_toolboxes_menudata_ref.xml
gui/wxpython/core/testsuite/data/test_toolboxes_user_toolboxes.xml
gui/wxpython/core/testsuite/test_gcmd.py
gui/wxpython/core/testsuite/toolboxes.sh
gui/wxpython/mapdisp/test_mapdisp.py

The "downside" is that codecov will not "know" that we have files not covered in that subfolder. That's why I made sure to keep the gui/wxpython/wxgui.py file and only exclude the subfolders starting from that level. With this, we still have an entry for the gui/ folder that has 0 coverage to remember that this folder exists.

@echoix echoix added this to the 8.5.0 milestone Oct 5, 2024
@github-actions github-actions bot added CI Continuous integration Python Related code is in Python labels Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous integration Python Related code is in Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant