Anyone noticed tests running slower on Python 3.12 ? If you're using coverage.py, the quick fix is to set env variable COVERAGE_CORE=sysmon. Just got 3.5x speedup for my tests.

Ref: https://github.com/nedbat/coveragepy/issues/1665 and https://github.com/python/cpython/issues/107674

#python #python312 #coveragepy #pytest #coverage #pytest_cov

Poor performance in Python 3.12 · Issue #1665 · nedbat/coveragepy

Describe the bug I recently added a Python 3.12-dev build to a project where I enable coverage on all the CI test runs, and the 3.12 build has consistently been taking nearly twice a long to comple...

GitHub
Sprinting on #coveragepy again at #pyconus this year! @kevin @grohe43 @nedbat @ludob

Сбор покрытия Flask (Python) в Runtime

Всем привет, меня зовут Осипов Станислав. Я занимаюсь AppSec/DevOps с 2021 года. В этой статье я хочу рассказать как можно собрать покрытие Python приложения в runtime (незавершая процесс). Что было использовано для сбора покрытия: https://github.com/pallets/flask - Flask 3.03 https://github.com/nedbat/coveragepy - coverage 7.5.1

https://habr.com/ru/articles/812861/

#покрытие_кода #flask #coveragepy #runtime

GitHub - pallets/flask: The Python micro framework for building web applications.

The Python micro framework for building web applications. - pallets/flask

GitHub

Did you know that it is possible to do conditional code coverage analysis?

See: https://github.com/wemake-services/coverage-conditional-plugin

#python #pytest #pytestcov #coveragepy #pythontesting

GitHub - wemake-services/coverage-conditional-plugin: Conditional coverage based on any rules you define!

Conditional coverage based on any rules you define! - wemake-services/coverage-conditional-plugin

GitHub

@coveragepy can now use Python 3.12's new sys.monitoring module with much lower overhead.

On 3.12, it's about the same as if you were running tests *without* coverage enabled!

https://nedbatchelder.com/blog/202312/coveragepy_with_sysmonitoring.html

With 7.4.2, you can set COVERAGE_CORE=sysmon globally on your CI, and it'll only use it where available (Python 3.12 and 3.13 alpha), and use the default for 3.11 and older.

For example, @pillow is 9% - 27% faster!

https://github.com/python-pillow/Pillow/pull/7820

#Python #coverage #CoveragePy #pytest #testing #CI

Coverage.py with sys.monitoring

Coverage.py now has experimental support for faster Python execution monitoring in Python 3.12. Please try it out!

TIL: exclude_also with coverage.py

Sometimes you have code you want to exclude from the test coverage report, because it doesn't really...

DEV Community