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

Stable vector set comparison #776

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

kpwelsh
Copy link
Collaborator

@kpwelsh kpwelsh commented Feb 27, 2025

Overview

This PR addresses a couple of small testing related issues.

Firstly, the recently introduced in #761 compare the results of the LAUE functions as ordered lists, when, in fact, the order is not neither guaranteed nor important. Here we change that comparison to first sort both arrays and then compare them so the order is ignored.

Secondly the pytest-cov plugin doesn't count code that is running in a separate process like when using a ProcessPoolExecutor.

To address the multiprocessing coverage, we can configure a .coveragerc file like the following, coverage will automatically start a new trace for each process created.

[run]
concurrency = multiprocessing
parallel = true
sigterm = true

Then we need to change the coverage report generation script like the following:

      run: |
          coverage run --include "./*" -m pytest tests/
          coverage combine
          coverage xml

After including these changes

Here is a function that is exclusively called in a separate process:
image

All told this brings the codecov up from the undercounted ~47% to the more correctly counted ~48%.

Note: pytest-cov also doesn't count @numba.jit functions. However, they represent <1% of the code in the library, and disabling jit for coverage tests (the commonly accepted answer) results in 5x runtime for the test cases. So we will continue to jit the functions and not worry about that.

@kpwelsh kpwelsh requested a review from psavery February 27, 2025 21:10
correctly include all relevant python files in HEXRD.
@kpwelsh kpwelsh marked this pull request as ready for review February 28, 2025 16:21
Copy link

codecov bot commented Feb 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.98%. Comparing base (2e193cf) to head (48bd402).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #776      +/-   ##
==========================================
+ Coverage   46.67%   47.98%   +1.30%     
==========================================
  Files         142      142              
  Lines       22826    22826              
==========================================
+ Hits        10655    10953     +298     
+ Misses      12171    11873     -298     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

1 participant