user [email protected]
usertags 1146037 python3.15
tags 1146037 patch
thanks
Hi!
While rebuilding the python related packages against the Python 3.15rc1
version we found that python-hupper fails to build from source [1].
The error is `No module named 'pytest_cov.embed'. Did you mean:
'pytest_cov.engine'?` and it's due to the fact that pytest_cov no longer
ships the embed module.
I'm proposing here a workaround that only uses the embed module if it
exists. This makes the test pass on both old and new pytest-cov. The
consequence of this is that the subprocess coverage is lost when running
against pytest-cov >= 7.
I applied this fix in the sandbox [2] to be able to build the packages
that depend on python-hupper, please consider applying the patch to
support the upcoming 3.15 version.
Happy hacking,
[1]: https://debusine.debian.net/debian/r-python-python3.15/artifact/4399490/
[2]: https://debusine.debian.net/debian/r-python-python3.15/
--
"Can you imagine what I would do if I could do all I can?" -- Sun Tzu
Saludos /\/\ /\ >< `/
Index: python-hupper/tests/myapp/__init__.py
===================================================================
--- python-hupper.orig/tests/myapp/__init__.py
+++ python-hupper/tests/myapp/__init__.py
@@ -1,11 +1,17 @@
-import pytest_cov.embed
import signal
import sys
+try:
+ from pytest_cov.embed import cleanup as pytest_cov_cleanup
+except ImportError:
+ pytest_cov_cleanup = None
+
def cleanup(*args, **kwargs): # pragma: no cover
# see https://github.com/pytest-dev/pytest-cov/issues/139
- pytest_cov.embed.cleanup()
+ if pytest_cov_cleanup is not None:
+ pytest_cov_cleanup()
+
sys.exit(1)