Subject: [bug#74652] [PATCH v2 2/3] gnu: python-fakeredis: Update to 2.26.1.

From: Ricardo Wurmus <[email-masked]>
Date: Mon, 2 Dec 2024 18:01:41 +0100

* gnu/packages/databases.scm (python-fakeredis): Update to 2.26.1.
[arguments]: Do not run slow tests; add phases 'poetry-compatibility and
'start-redis.
[propagated-inputs]: Add python-typing-extensions.
[native-inputs]: Add redis.

Change-Id: I18ed122d9e5307d3d723cfc9ef0d51f120b4ccb5
---
 gnu/packages/databases.scm | 38 ++++++++++++++++++++++++++++----------
 1 file changed, 28 insertions(+), 10 deletions(-)

diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index c7edada862c..996d61e486d 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -4341,7 +4341,7 @@ (define-public python-hiredis
 (define-public python-fakeredis
   (package
     (name "python-fakeredis")
-    (version "2.10.1")
+    (version "2.26.1")
     (source (origin
               (method git-fetch)        ;for tests
               (uri (git-reference
@@ -4350,18 +4350,36 @@ (define-public python-fakeredis
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "1imsi9dswvkda894sm53lfzdsna0qlrgxszczlq2sam68zn4hfz6"))))
+                "10f9qwpc9vlcd2411c398n9kwjsk399vk1pjd9dbczlhvsn9s5bq"))))
     (build-system pyproject-build-system)
     (arguments
-     (list #:phases #~(modify-phases %standard-phases
-                        (add-after 'unpack 'relax-requirements
-                          (lambda _
-                            (substitute* "pyproject.toml"
-                              (("sortedcontainers = \"\\^2\\.4\"")
-                               "sortedcontainers = \"^2.1\"")))))))
+     (list
+      #:test-flags '(list "-m" "not slow")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'poetry-compatibility
+            (lambda _
+              ;; Our version of poetry does not understand "to".
+              (substitute* "pyproject.toml"
+                ((", to = \"fakeredis\" ") ""))))
+          (add-after 'unpack 'relax-requirements
+            (lambda _
+              (substitute* "pyproject.toml"
+                (("sortedcontainers = \"\\^2\\.4\"")
+                 "sortedcontainers = \"^2.1\""))))
+          ;; Tests require a running Redis server.
+          (add-before 'check 'start-redis
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (invoke "redis-server" "--daemonize" "yes"
+                        "--port" "6390")))))))
     (native-inputs (list python-poetry-core python-pytest
-                         python-pytest-asyncio python-pytest-mock))
-    (propagated-inputs (list python-redis python-sortedcontainers))
+                         python-pytest-asyncio python-pytest-mock
+                         redis))
+    (propagated-inputs
+     (list python-redis
+           python-sortedcontainers
+           python-typing-extensions))
     (home-page "https://github.com/cunla/fakeredis-py")
     (synopsis "Fake implementation of redis API for testing purposes")
     (description
-- 
2.46.0