Subject: [bug#66886] [PATCH v4 6/6] gnu: python-textual: Update to 0.47.1.

From: Giacomo Leidi <[email-masked]>
Date: Mon, 15 Jan 2024 00:59:38 +0100

* gnu/packages/python-xyz.scm (python-textual): Update to 0.47.1;
[source]: switch to git-origin;
[build-system]: switch to pyproject-build-system;
[arguments]<test-flags>: disable failing tests;
<phases>: use check phase from pyproject-build-system and adapt build
machinery to our old version of poetry;
[propagated-inputs]: adapt to pyproject.toml;
[native-inputs] add poetry and python-pytest-asyncio.

Change-Id: I1060b25cb2ec439f26a4348305bc05fd0b09cf07
---
 gnu/packages/python-xyz.scm | 58 ++++++++++++++++++++++---------------
 1 file changed, 34 insertions(+), 24 deletions(-)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index e2013a3995..997b40172e 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -18665,20 +18665,8 @@ (define-public python-rich-click
 (define-public python-textual
   (package
     (name "python-textual")
-    (version "0.1.18")
+    (version "0.47.1")
     (source (origin
-              (method url-fetch)
-              (uri (pypi-uri "textual" version))
-              (sha256
-               (base32
-                "08yg5a51hz1axfj5hx28hx31gq5apcj6vpkkmawmiplisa73z25j"))))
-    (build-system python-build-system)
-    (arguments
-     (let ((tests
-            ;; The release on pypi comes without tests.  We can't build
-            ;; from this checkout, though, because installation requires
-            ;; an invocation of poetry.
-            (origin
               (method git-fetch)
               (uri (git-reference
                     (url "https://github.com/Textualize/textual")
@@ -18686,19 +18674,41 @@ (define-public python-textual
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0b3ycwqhp21mg9fvmadgxhgbvkwq6fd784l2xcmvy77rravrnnax")))))
-       (list #:phases
-             #~(modify-phases %standard-phases
-                 (replace 'check
-                   (lambda* (#:key tests? #:allow-other-keys)
-                     (when tests?
-                       (copy-recursively #$(file-append tests "/tests")
-                                         "tests")
-                       (invoke "python" "-m" "pytest" "-vv"))))))))
+                "1984v02n2wa7rqgq0f0mkma8fd0nnnbgfwcwgmpsd8xl1wlrjmj4"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      ;; 3 failed, 1932 passed, 1 skipped, 4 xfailed, 10 warnings in 115.19s (0:01:55)
+      #:test-flags
+      #~'("-k"
+          ;; this test fails because of an AssertionError:
+          ;; assert app.devtools is not None
+          #$(string-append "not test_textual_env_var"
+                           ;; these tests require python-tresitter-languages
+                           " and not test_register_language"
+                           " and not test_register_language_existing_language"))
+      #:phases #~(modify-phases %standard-phases
+                   ;; TODO: This is because of our old version of poetry.
+                   ;; It can be removed once it's been updated to a current one.
+                   (add-after 'unpack 'adapt-pyproject.toml
+                     (lambda _
+                       (substitute* "pyproject.toml"
+                         (("group\\.dev\\.") "dev-"))))
+                   ;; snapshot tests require syrupy
+                   (add-after 'adapt-pyproject.toml 'remove-snapshot-tests
+                     (lambda _
+                       (delete-file "tests/snapshot_tests/test_snapshots.py"))))))
     (propagated-inputs
-     (list python-rich python-typing-extensions))
+     (list python-importlib-metadata
+           python-linkify-it-py
+           python-markdown-it-py
+           python-mdit-py-plugins
+           python-rich
+           python-typing-extensions))
     (native-inputs
-     (list python-pytest))
+     (list poetry
+           python-pytest
+           python-pytest-asyncio))
     (home-page "https://github.com/Textualize/textual")
     (synopsis "Build text user interfaces in Python")
     (description "Textual is a @acronym{TUI, Text User Interface} framework
-- 
2.41.0