guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/03: gnu: onionshare: Update to 2.5 and disable tests.


From: guix-commits
Subject: 02/03: gnu: onionshare: Update to 2.5 and disable tests.
Date: Tue, 12 Jul 2022 00:08:38 -0400 (EDT)

apteryx pushed a commit to branch master
in repository guix.

commit aedd7dc8e085788fbaf066754eb3387edb719335
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Mon Jul 11 23:47:21 2022 -0400

    gnu: onionshare: Update to 2.5 and disable tests.
    
    * gnu/packages/tor.scm (onionshare): Update to 2.5.
    [tests?]: Set to #f.
    [phases]: Use gexps.
    {patch-tests}: Delete phase.
    {check}: Invoke pytest through xvfb-run.
---
 gnu/packages/tor.scm | 117 +++++++++++++++++++--------------------------------
 1 file changed, 44 insertions(+), 73 deletions(-)

diff --git a/gnu/packages/tor.scm b/gnu/packages/tor.scm
index 82880165f1..0933815016 100644
--- a/gnu/packages/tor.scm
+++ b/gnu/packages/tor.scm
@@ -11,6 +11,7 @@
 ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
 ;;; Copyright © 2020 André Batista <nandre@riseup.net>
 ;;; Copyright © 2021 Danial Behzadi <dani.behzi@ubuntu.com>
+;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -53,7 +54,8 @@
   #:use-module (gnu packages qt)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages tls)
-  #:use-module (gnu packages w3m))
+  #:use-module (gnu packages w3m)
+  #:use-module (gnu packages xorg))
 
 (define-public tor
   (package
@@ -312,88 +314,57 @@ OnionShare.")
     (license (list license:gpl3+ license:expat))))
 
 (define-public onionshare
-  (package (inherit onionshare-cli)
+  (package
+    (inherit onionshare-cli)
     (name "onionshare")
     (arguments
      (substitute-keyword-arguments (package-arguments onionshare-cli)
-      ((#:phases phases)
-       `(modify-phases ,phases
-         (replace 'change-directory
-           (lambda _ (chdir "desktop/src")))
-         (add-after 'unpack 'patch-tests
-           (lambda _
-             ;; Disable tests that require starting servers, which will hang
-             ;; during build:
-             ;; - test_autostart_and_autostop_timer_mismatch
-             ;; - test_autostart_timer
-             ;; - test_autostart_timer_too_short
-             ;; - test_autostop_timer_too_short
-             (substitute* "desktop/tests/test_gui_share.py"
-               (("import os" &)
-                (string-append "import pytest\n" &))
-               (("( *)def 
test_autost(art|op)_(timer(_too_short)?|and_[^(]*)\\(" & >)
-                (string-append > "@pytest.mark.skip\n" &)))
-             ;; - test_13_quit_with_server_started_should_warn
-             (substitute* "desktop/tests/test_gui_tabs.py"
-               (("import os" &)
-                (string-append "import pytest\n" &))
-               (("( *)def test_13" & >)
-                (string-append > "@pytest.mark.skip\n" &)))
-             ;; Remove multiline load-path adjustment, so that onionshare-cli
-             ;; modules are loaded from input
-             (use-modules (ice-9 regex)
-                          (ice-9 rdelim))
-             (with-atomic-file-replacement "desktop/tests/conftest.py"
-               (let ((start-rx (make-regexp "^# Allow importing")))
-                 (lambda (in out)
-                   (let loop ()
-                     (let ((line (read-line in 'concat)))
-                       (if (regexp-exec start-rx line)
-                           (begin      ; slurp until closing paren
-                             (let slurp ()
-                               (let ((line (read-line in 'concat)))
-                                 (if (string=? line ")\n")
-                                     (dump-port in out) ; done
-                                     (slurp)))))
-                           (begin
-                             (display line out)
-                             (loop))))))))))
-         (replace 'check
-           (lambda* (#:key tests? inputs outputs #:allow-other-keys)
-             (when tests?
-               ;; Some tests need a writable homedir:
-               (setenv "HOME" "/tmp")
-               ;; Ensure installed modules can be found:
-               (add-installed-pythonpath inputs outputs)
-               ;; Avoid `getprotobyname` issues:
-               (setenv "EVENTLET_NO_GREENDNS" "yes")
-               ;; Make Qt render "offscreen":
-               (setenv "QT_QPA_PLATFORM" "offscreen")
-               ;; Must be run from "desktop" dir:
-               (with-directory-excursion ".."
-                 (invoke "./tests/run.sh")))))
-         (add-after 'install 'install-data
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (share (string-append out "/share")))
-               (install-file "org.onionshare.OnionShare.svg"
-                             (string-append share 
"/icons/hicolor/scalable/apps"))
-               (install-file "org.onionshare.OnionShare.desktop"
-                             (string-append share "/applications")))))))))
+       ((#:phases phases)
+        #~(modify-phases #$phases
+            (replace 'change-directory
+              (lambda _ (chdir "desktop/")))
+            (add-after 'install 'install-data
+              (lambda _
+                (install-file "org.onionshare.OnionShare.svg"
+                              (string-append #$output
+                                             
"/share/icons/hicolor/scalable/apps"))
+                (install-file "org.onionshare.OnionShare.desktop"
+                              (string-append #$output
+                                             "/share/applications"))))
+            (replace 'check
+              (lambda* (#:key tests? #:allow-other-keys)
+                (when tests?
+                  ;; Remove multiline load-path adjustment, so that
+                  ;; onionshare-cli modules are loaded from input
+                  (substitute* "tests/conftest.py"
+                    (("\"cli\",")
+                     "\"/nonexistent\""))
+                  ;; Avoid `getprotobyname` issues:
+                  (setenv "EVENTLET_NO_GREENDNS" "yes")
+                  ;; Make Qt render "offscreen":
+                  (setenv "QT_QPA_PLATFORM" "offscreen")
+                  (setenv "HOME" "/tmp")
+                  (apply invoke "xvfb-run" "pytest" "-vv"
+                         (find-files "tests" "^test_gui.*\\.py$")))))))
+       ;; Most tests fail: "2 failed, 8 warnings, 44 errors in 6.06s", due to
+       ;; error "RuntimeError: Please destroy the Application singleton before
+       ;; creating a new Application instance." (see:
+       ;; https://github.com/onionshare/onionshare/issues/1603).
+       ((#:tests? _ #f)
+        #f)))
     (native-inputs
      (list python-pytest))
     (inputs
-     ;; TODO: obfs4proxy
+     ;; The desktop client uses onionshare-cli like a python module.  But
+     ;; propagating onionshare-cli's inputs is not great, since a user would
+     ;; not expect to have those installed when using onionshare-cli as a
+     ;; standalone utility.  So add onionshare-cli's inputs here.
      (modify-inputs (package-inputs onionshare-cli)
-       (prepend onionshare-cli
+       (prepend onionshare-cli          ;TODO: package obfs4proxy
                 python-shiboken-2
                 python-pyside-2
                 python-qrcode
-                ;; The desktop client uses onionshare-cli like a python 
module.  But
-                ;; propagating onionshare-cli's inputs is not great, since a 
user would
-                ;; not expect to have those installed when using 
onionshare-cli as a
-                ;; standalone utility.  So add onionshare-cli's inputs here.
-                )))
+                xvfb-run)))
     (description "OnionShare lets you securely and anonymously share files,
 host websites, and chat with friends using the Tor network.")))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]