Skip to content

Conversation

@danielhollas
Copy link
Collaborator

@danielhollas danielhollas commented Oct 6, 2025

In general, collecting code coverage (pytest --cov) makes the test suite run quite a bit slower.
However, the new version of coveragepy allows to use a different approach based on the new sys.monitoring interface (3.12+) which is much faster (almost free), see https://nedbatchelder.com/blog/202312/coveragepy_with_sysmonitoring.html

https://coverage.readthedocs.io/en/7.10.7/config.html#run-core

Besides that, if TYPE_CHECKING: blocks are now automatically ignored, resulting in a "increase" of overall coverage (less uncovered lines of code).

This PR drops the runtime of the Py3.9(psql) job from 26 to 20 minutes! 🎉

@codecov
Copy link

codecov bot commented Oct 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.60%. Comparing base (17b484f) to head (428ff77).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7042      +/-   ##
==========================================
- Coverage   79.30%   77.60%   -1.69%     
==========================================
  Files         566      566              
  Lines       43876    43498     -378     
==========================================
- Hits        34790    33754    -1036     
- Misses       9086     9744     +658     

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

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

@danielhollas danielhollas marked this pull request as ready for review October 6, 2025 03:45
@danielhollas danielhollas requested a review from GeigerJ2 October 7, 2025 14:27
@danielhollas danielhollas requested a review from mbercx October 7, 2025 14:34
Copy link
Contributor

@GeigerJ2 GeigerJ2 left a comment

Choose a reason for hiding this comment

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

Sorry for taking so long to get back here, had some other tasks going on. Thanks for the changes! Just wondering if we can already pin coverage it to 7.11 by now? Apart from that, LGTM.

pyproject.toml Outdated
'pytest-xdist~=3.6',
'pympler~=1.0',
'coverage~=7.0',
'coverage~=7.10',
Copy link
Contributor

Choose a reason for hiding this comment

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

By now, could even be 7.11 (released 15 Oct)? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can't put 7.11 as minimum version since it dropped Python 3.9 support. But I've updated the lockfile so that this version is used with Python 3.13, which we use in CI.

But ultimately, we don't need to depend on coverage directly, since we're running in via pytest-cov plugin. So I've bumped pytest-cov plugin to latest version, which sets the minimum coverage version to 7.10.6: https://pytest-cov.readthedocs.io/en/latest/changelog.html#id1

In general, collecting code coverage with `pytest --cov`
makes the test suite run quite a bit slower.
However, the new version of coveragepy allows to use a different
approach based on the new sys.monitoring interface (3.12+)
which is much faster (almost free), see:

https://nedbatchelder.com/blog/202312/coveragepy_with_sysmonitoring.html
@danielhollas danielhollas requested a review from GeigerJ2 October 27, 2025 15:56
@danielhollas
Copy link
Collaborator Author

FAILED tests/engine/processes/calcjobs/test_calc_job.py::test_monitor_result_action_disable_self - assert 0 == 1

  • where 0 = len([])

Looks like a flaky test, I've rerun the job.

@danielhollas danielhollas enabled auto-merge (squash) October 27, 2025 16:18
@danielhollas danielhollas disabled auto-merge October 28, 2025 12:46
@danielhollas danielhollas merged commit 1f2cb47 into aiidateam:main Oct 28, 2025
35 of 37 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