Subject: [bug#67237] [PATCH 21/32] gnu: python-extension-helpers: Enable tests.

From: Sharlatan Hellseher <[email-masked]>
Date: Fri, 17 Nov 2023 12:16:10 +0000

* gnu/packages/python-xyz.scm (python-extension-helpers): Enable tests.
[arguments]{phases}: Add 'prepare-test-environment phase.

Change-Id: I6effa60f3ccd334d11b5f86162742f2272f737b1
---
 gnu/packages/python-xyz.scm | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 318ce539db..6d3e30a91e 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -4254,9 +4254,22 @@ (define-public python-extension-helpers
       (sha256
         (base32 "1rjha07ds633fb81hn3i2yzk3v2flbi6qa091ix4mkvrgk3gl6ya"))))
   (build-system pyproject-build-system)
-  ;; FIXME: pytest failed to load test suit, find out why.
-  ;;  - _pytest.pathlib.ImportPathMismatchError: ('extension_helpers.conftes
-  (arguments (list #:tests? #f))
+  (arguments
+   (list
+    #:phases
+    #~(modify-phases %standard-phases
+        (add-before 'check 'prepare-test-environment
+          (lambda _
+            ;; To solve pytest/conftest issue. Pytest tries to load all
+            ;; files with word 'test' in them.
+            ;;
+            ;; ImportError while loading conftest ...
+            ;; _pytest.pathlib.ImportPathMismatchError: ...
+            ;;
+            (call-with-output-file "pytest.ini"
+              (lambda (port)
+                (format port "[pytest]
+python_files = test_*.py"))))))))
   (native-inputs
     (list python-coverage
           python-pytest
-- 
2.41.0