Skip to content

Python test coverage improvements#399

Merged
knoepfel merged 13 commits intoFramework-R-D:mainfrom
wlav:python-coverage
Mar 13, 2026
Merged

Python test coverage improvements#399
knoepfel merged 13 commits intoFramework-R-D:mainfrom
wlav:python-coverage

Conversation

@wlav
Copy link
Contributor

@wlav wlav commented Mar 6, 2026

Python test coverage was reduced in #369 to due refactoring of the code handling various types. This code provides further cleanup by normalizing Python annotations and providing better support for Numpy. This provides two ways for better testing:

  • It removes many branches on the C++ side, since it now only needs to deal with canonicalized annotations.
  • Many tests can now be moved to the Python side where it's simpler to generate test case.

Additionally, this PR improves the support for numpy types. The test do not strictly use numpy types throughout, in order to provide for tests of C++ types as strings, but from here on out, use of numpy types should be encouraged. The advantages of numpy types are:

  • Improved correctness, e.g. use of fully specified np.int64, instead of implementation-defined long.
  • Full support from Python code quality tools, instead of having to put #noqa everywhere.

There is some further refactoring to make code more consistent and some Python tests are now enabled even if cppyy is not found (they should never have been conditional on that).

@wlav wlav requested a review from greenc-FNAL March 6, 2026 20:00
@codecov
Copy link

codecov bot commented Mar 6, 2026

Codecov Report

❌ Patch coverage is 85.71429% with 25 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
plugins/python/src/modulewrap.cpp 72.72% 8 Missing and 13 partials ⚠️
plugins/python/python/phlex/_typing.py 93.65% 4 Missing ⚠️
@@            Coverage Diff             @@
##             main     #399      +/-   ##
==========================================
+ Coverage   83.77%   84.22%   +0.45%     
==========================================
  Files         126      128       +2     
  Lines        3291     3322      +31     
  Branches      583      564      -19     
==========================================
+ Hits         2757     2798      +41     
+ Misses        325      324       -1     
+ Partials      209      200       -9     
Flag Coverage Δ
unittests 84.22% <85.71%> (+0.45%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
plugins/python/python/phlex/__init__.py 100.00% <100.00%> (ø)
plugins/python/python/phlex/_variant.py 100.00% <100.00%> (ø)
plugins/python/python/phlex/_typing.py 93.65% <93.65%> (ø)
plugins/python/src/modulewrap.cpp 72.42% <72.72%> (+1.11%) ⬆️

... and 4 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b9c382c...71aba5a. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wlav
Copy link
Contributor Author

wlav commented Mar 7, 2026

@phlexbot format

@wlav
Copy link
Contributor Author

wlav commented Mar 7, 2026

@phlexbot python-fix

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2026

No automatic ruff fixes were necessary.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2026

Format Fixes Applied

✅ cmake-format fixes pushed (commit 0bc921e)
✅ ruff fixes pushed (commit e1b21e5)
✅ YAML formatter fixes pushed (commit 3f775b5)

⚠️ Note: Some issues may require manual review and fixing.

@greenc-FNAL
Copy link
Contributor

Review the full CodeQL report for details.

Copy link
Contributor

@greenc-FNAL greenc-FNAL left a comment

Choose a reason for hiding this comment

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

CMake changes look reasonable to me.

@knoepfel knoepfel merged commit 27ac10e into Framework-R-D:main Mar 13, 2026
61 checks passed
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.

3 participants