guix_mirror_bot pushed a commit to branch master
in repository guix.
commit 19a0f5957b196d47a8d48515c5d05c7106d1b2e3
Author: Sören Tempel <[email protected]>
AuthorDate: Wed Nov 4 19:19:41 2026 +0100
gnu: python-pika: Fix 'check.
Currently, the tests fail because they fail to import from the
tests namespace of python-pika. This happens because both
python-cryptography (an indirect dependency of python-pika) and
python-pika provide tests/ and are both in the GUIX_PYTHONPATH.
Since python-pika does not provide a __init__.py file in its tests/
subdirectory, it is treated as a namespace package (even though in
comes first in GUIX_PYTHONPATH) and Python thus tries to lookup the
test imports in python-cryptography, which fails.
See: https://docs.python.org/3/reference/import.html#regular-packages
* gnu/packages/python-xyz.scm (python-pika)
[arguments]<#:phases>{configure-tests}: Create tests/__init__.py
Merges: guix/guix!12320
Relates-to: guix/guix#12265
Signed-off-by: Sharlatan Hellseher <[email protected]>
---
gnu/packages/python-xyz.scm | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index f446971894f..1e4f7e9fb28 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -23206,6 +23206,13 @@ format.")
(add-before 'check 'configure-tests
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
+ ;; Make sure that tests/ is treated as a regular package, not
+ ;; a "namespace package" as other packages in GUIX_PYTHONPATH
+ ;; may provide tests/ as well.
+ ;;
+ ;; See
https://docs.python.org/3/reference/import.html#regular-packages
+ (call-with-output-file "tests/__init__.py" (const #t))
+
(setenv "PYTHONPATH" (getcwd))))))))
(native-inputs (list python-pytest
python-gevent