From 0e649f3631b03d4cfda2785dea798af6dbe3e4c5 Mon Sep 17 00:00:00 2001 From: Vinicius Monego Date: Sat, 26 Jul 2025 15:01:04 -0300 Subject: [PATCH] gnu: deluge: Enable tests. * gnu/packages/bittorrent.scm (deluge)[native-inputs]: Add python-pytest, python-pytest-twisted, xorg-server-for-tests. [arguments]: Remove '#:tests? #f'. <#:test-flags>: Skip failing tests. <#:phases>: Add phase 'pre-check' before 'check'. Change-Id: I32e0f4d5d580535834261c15925003bf813ec035 --- gnu/packages/bittorrent.scm | 39 ++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/gnu/packages/bittorrent.scm b/gnu/packages/bittorrent.scm index f11f8543751fcbd88ed9d5739fe1b6efaff21e5b..0e3f5bf6729dc0bf6f3780af12654d73483501bf 100644 --- a/gnu/packages/bittorrent.scm +++ b/gnu/packages/bittorrent.scm @@ -81,6 +81,7 @@ #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) #:use-module (gnu packages python-build) + #:use-module (gnu packages python-check) #:use-module (gnu packages python-crypto) #:use-module (gnu packages python-web) #:use-module (gnu packages python-xyz) @@ -90,7 +91,8 @@ #:use-module (gnu packages tls) #:use-module (gnu packages version-control) #:use-module (gnu packages web) - #:use-module (gnu packages xml)) + #:use-module (gnu packages xml) + #:use-module (gnu packages xorg)) (define-public transmission (package @@ -630,19 +632,42 @@ the following features: python-twisted python-zope-interface)) (native-inputs - (list intltool python-setuptools python-wheel)) + (list intltool + python-pytest + python-pytest-twisted + python-setuptools + python-wheel + xorg-server-for-tests)) (native-search-paths (list $SSL_CERT_DIR $SSL_CERT_FILE)) - ;; TODO: Enable tests. - ;; After "pytest-twisted" is packaged, HOME is set, and an X server is - ;; started, some of the tests still fail. There are likely some tests - ;; that require a network connection. (arguments (list - #:tests? #f + #:test-flags + #~(list "-m" "not internet and not slow" ;; Ignore these markers. + "-k" (string-append "not " + (string-join + ;; Tests below require a running daemon. + (list "TestClient" + "TestJSON" + "TestJSONCustomUserCase" + "TestRPCRaiseDelugeErrorJSON" + "TestConsoleScriptEntryWithDaemon" + ;; These need a connection. + "TestWebAPI" + "TestWebServer" + ;; These failed with AssertionError. + "test_is_interface_name" + "test_is_interface") + " and not "))) #:phases #~(modify-phases %standard-phases + (add-before 'check 'pre-check + (lambda _ + ;; Setup X server for tests and a writable HOME. + (system "Xvfb &") + (setenv "DISPLAY" ":0") + (setenv "HOME" "/tmp"))) (add-before 'wrap 'wrap-deluge (lambda _ (for-each