summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-03-19 23:29:40 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-03-20 08:38:07 -0400
commit1a902eb21ab6b23b01678f1408951a3a47a45a30 (patch)
tree147d45c717248ef377f382e9b240b4ee9fa2e176 /gnu
parent20fa738123d005bb543a09974c5c981917d10264 (diff)
downloadguix-1a902eb21ab6b23b01678f1408951a3a47a45a30.tar.gz
gnu: python-redis: Update to 4.5.2 and enable tests.
* gnu/packages/databases.scm (python-redis): Update to 4.5.2.
[source]: Fetch from git.
[build-system]: Use pyproject-build-system.
[arguments]: Enable tests.  Add #:test-flags and #:phases.
[native-inputs]: Add field.
[propagated-inputs]: Add field.
[home-page]: Update URL.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/databases.scm63
1 files changed, 49 insertions, 14 deletions
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 3a21f64819..acb17f5a4e 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -4000,20 +4000,55 @@ reasonable substitute.")
 (define-public python-redis
   (package
     (name "python-redis")
-    (version "3.5.3")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (pypi-uri "redis" version))
-       (sha256
-        (base32 "18h5b87g15x3j6pb1h2q27ri37p2qpvc9n2wgn5yl3b6m3y0qzhf"))))
-    (build-system python-build-system)
-    ;; Tests require a running Redis server.
-    (arguments '(#:tests? #f))
-    ;; As long as we are not running test, we do not need this input :-)
-    ;;(native-inputs
-    ;; `(("python-pytest" ,python-pytest)))
-    (home-page "https://github.com/andymccurdy/redis-py")
+    (version "4.5.2")
+    (source (origin
+              ;; The PyPI archive lacks some test resources such as the TLS
+              ;; certificates under docker/stunnel/keys.
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/redis/redis-py")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0cz3gji3rb1h5dczyl11hm42wgsbz5v896cgbi14dij160b7m35i"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:test-flags
+      #~(list "-m"
+              ;; These tests are disabled in the official CI run (see:
+              ;; https://raw.githubusercontent.com/redis/redis-py/master/
+              ;; .github/workflows/install_and_test.sh).
+              (string-append "not onlycluster "
+                             "and not redismod "
+                             "and not ssl")
+              "-k" (string-append
+                    ;; The autoclaim test fails with "AssertionError: assert
+                    ;; [b'0-0', [], []] == [b'0-0', []]".
+                    "not test_xautoclaim "
+                    ;; These tests cause the following error: "Error 111
+                    ;; connecting to localhost:6380. Connection refused."
+                    ;; (see: https://github.com/redis/redis-py/issues/2109).
+                    "and not test_sync "
+                    "and not test_psync"))
+      #:phases
+      #~(modify-phases %standard-phases
+          ;; Tests require a running Redis server.
+          (add-before 'check 'start-redis
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (invoke "redis-server" "--daemonize" "yes"
+                        "--enable-debug-command" "yes"
+                        "--enable-module-command" "local")))))))
+    (native-inputs
+     (list python-pytest
+           python-pytest-asyncio
+           python-pytest-timeout
+           redis))
+    (propagated-inputs
+     (list python-async-timeout))
+    (home-page "https://github.com/redis/redis-py")
     (synopsis "Redis Python client")
     (description
      "This package provides a Python interface to the Redis key-value store.")