rekado pushed a commit to branch python-team
in repository guix.

commit c25e3161359bc91ee2b28c5bb0a4273fc7318724
Author: Sharlatan Hellseher <sharlata...@gmail.com>
AuthorDate: Sun Jan 26 01:05:07 2025 +0000

    gnu: python-uvloop: Fix build, improve style.
    
    * gnu/packages/python-web.scm (python-uvloop) [arguments] <test-flags>:
    Move test skip logic here. Skip one more test.
    <phases>: Use default 'check, add 'pre-check.
    
    Change-Id: I0cee23f36943d5cc9431b0b6b5b6e729949569cf
---
 gnu/packages/python-web.scm | 76 ++++++++++++++++++++++++---------------------
 1 file changed, 40 insertions(+), 36 deletions(-)

diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 367b0ab26a..b58445b138 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -7237,13 +7237,43 @@ hard or impossible to fix in cssselect.")
        (sha256
         (base32 "1qq46ym3ymzfn4j6fnykfmr1f4qnb7x7p15dlw37hi38v87jpw9v"))
        (modules '((guix build utils)))
-        (snippet
-         '(begin (delete-file-recursively "vendor")
-                 (delete-file  "uvloop/loop.c")))))
+       (snippet
+        '(begin (delete-file-recursively "vendor")
+          (delete-file  "uvloop/loop.c")))))
     (build-system pyproject-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
+     (list
+      #:test-flags
+      ;; The tests are prone to get stuck. Use pytest-timeout’s --timeout flag
+      ;; to get a meaningful idea about where.
+      #~(list "--timeout=300"
+              "--timeout-method=thread"
+              "-k" (string-join
+                    (list
+                     ;; Timeout, because SIGINT cannot be sent to child.
+                     "not test_signals_sigint_pycode_continue"
+                     "test_signals_sigint_pycode_stop"
+                     "test_signals_sigint_uvcode"
+                     "test_signals_sigint_uvcode_two_loop_runs"
+                     ;; This test is racy and prone to get stuck on
+                     ;; various platforms, possibly a aiohttp issue:
+                     ;;  https://github.com/MagicStack/uvloop/issues/412
+                     "test_remote_shutdown_receives_trailing_data"
+                     ;; It looks like pytest is preventing
+                     ;; custom stdout/stderr redirection,
+                     ;; even with -s.
+                     "test_process_streams_redirect"
+                     ;; FileNotFoundError: [Errno 2] No such file or
+                     ;; directory
+                     "test_process_env_2"
+                     ;; socket.gaierror: [Errno -2] Name or service not known
+                     "test_getaddrinfo_21"
+                     ,@(if (target-riscv64?)
+                           `("test_renegotiation")
+                           `()))
+                    " and not "))
+      #:phases
+       #~(modify-phases %standard-phases
          (add-after 'unpack 'preparations
            (lambda _
              ;; Use packaged libuv.
@@ -7251,8 +7281,7 @@ hard or impossible to fix in cssselect.")
                                       "self.use_system_libuv = True"))
              ;; Replace hardcoded shell command.
              (substitute* "uvloop/loop.pyx"
-               (("b'/bin/sh'") (string-append "b'" (which "sh") "'")))
-             #t))
+               (("b'/bin/sh'") (string-append "b'" (which "sh") "'")))))
          ,@(if (target-riscv64?)
                `((add-after 'unpack 'adjust-test-timeouts
                    (lambda _
@@ -7261,37 +7290,12 @@ hard or impossible to fix in cssselect.")
                        (("SSL_HANDSHAKE_TIMEOUT = 15\\.0")
                         "SSL_HANDSHAKE_TIMEOUT = 30.0")))))
                '())
-         (replace 'check
+         (add-before 'check 'pre-check
            (lambda* (#:key tests? #:allow-other-keys)
              (when tests?
-               ;; Remove Python module, which conflicts with the installed 
version,
-               ;; but lacks the built C module.
-               (delete-file-recursively "uvloop")
-               ;; The tests are prone to get stuck. Use pytest-timeout’s 
--timeout
-               ;; flag to get a meaningful idea about where.
-               (invoke "pytest" "-vv" "--timeout=300"
-                       "--timeout-method=thread"
-                       "-k" (string-append
-                              ;; Timeout, because SIGINT cannot be sent to 
child.
-                              "not test_signals_sigint_pycode_continue "
-                              "and not test_signals_sigint_pycode_stop "
-                              "and not test_signals_sigint_uvcode "
-                              "and not 
test_signals_sigint_uvcode_two_loop_runs "
-                              ;; This test is racy and prone to get stuck on
-                              ;; various platforms, possibly a aiohttp issue:
-                              ;;  
https://github.com/MagicStack/uvloop/issues/412
-                              "and not 
test_remote_shutdown_receives_trailing_data "
-                              ;; It looks like pytest is preventing
-                              ;; custom stdout/stderr redirection,
-                              ;; even with -s.
-                              "and not test_process_streams_redirect "
-                              ;; FileNotFoundError: [Errno 2] No such file or
-                              ;; directory
-                              "and not test_process_env_2"
-                              ,@(if (target-riscv64?)
-                                    `(" and not test_renegotiation"
-                                      " and not test_getaddrinfo_21")
-                                    `())))))))))
+               ;; Remove Python module, which conflicts with the installed
+               ;; version, but lacks the built C module.
+               (delete-file-recursively "uvloop")))))))
     (native-inputs
      (list python-aiohttp
            python-cython-3

Reply via email to