From patchwork Thu Jun 19 07:58:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Graves X-Patchwork-Id: 43207 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id F28CE27BC4B; Thu, 19 Jun 2025 09:01:04 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 4E7E927BC49 for ; Thu, 19 Jun 2025 09:01:02 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uSACe-00008O-1M; Thu, 19 Jun 2025 04:00:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uSABt-0008Hq-F3 for guix-patches@gnu.org; Thu, 19 Jun 2025 04:00:11 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uSABq-0008Tu-83 for guix-patches@gnu.org; Thu, 19 Jun 2025 04:00:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=KLSB1lKct6DBF2Qtr28RX/O3DchTtTmriIE/WHC1sUc=; b=XuluxvDuC3T9/nAHz8ikLn7zvlTropUVRlTh9LloiGZx+VzQ41TuvCyIjmD3VZlxfdZlFPAiVkwsRce6OWBQ/CmQefNuD6OKJ0FqH2uzBYbyQ7SV07ipH+SnParYMg4ZzNKrOD5y/4AFqDugNzAoz6koBwuxgW586+8fjUk2YEgrAtUnme/PX2v+GfXnICErQ4DYlsdCTbTxI2w2uaiKVvsPrRIYt0JWG/x/SdfqMyxhxOTVHzRpk7Wi9dZCC5Y8B8SujoVCdcb9zMZ+c5dl2Rxz0jqBO71G5ej5sgBZNfEn7fAC8g5DD1w1syHD2vY9PtGYzg9RvS95J0TtNksrDA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uSABp-0006vJ-Nk for guix-patches@gnu.org; Thu, 19 Jun 2025 04:00:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78828] [PATCH 2/8] build-system/pyproject: Add stestr, unittest and custom options. Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 19 Jun 2025 08:00:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78828 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 78828@debbugs.gnu.org Cc: Nicolas Graves Received: via spool by 78828-submit@debbugs.gnu.org id=B78828.175031995826158 (code B ref 78828); Thu, 19 Jun 2025 08:00:05 +0000 Received: (at 78828) by debbugs.gnu.org; 19 Jun 2025 07:59:18 +0000 Received: from localhost ([127.0.0.1]:60322 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uSAAw-0006mQ-9x for submit@debbugs.gnu.org; Thu, 19 Jun 2025 03:59:18 -0400 Received: from 4.mo563.mail-out.ovh.net ([46.105.53.192]:34817) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uSAAr-0006lO-EM for 78828@debbugs.gnu.org; Thu, 19 Jun 2025 03:59:08 -0400 Received: from director2.derp.mail-out.ovh.net (director2.derp.mail-out.ovh.net [79.137.60.36]) by mo563.mail-out.ovh.net (Postfix) with ESMTPS id 4bNCfv5JN2z1d8N; Thu, 19 Jun 2025 07:59:03 +0000 (UTC) Received: from director2.derp.mail-out.ovh.net (director2.derp.mail-out.ovh.net. [127.0.0.1]) by director2.derp.mail-out.ovh.net (inspect_sender_mail_agent) with SMTP for <78828@debbugs.gnu.org>; Thu, 19 Jun 2025 07:59:03 +0000 (UTC) Received: from mta7.priv.ovhmail-u1.ea.mail.ovh.net (unknown [10.109.249.67]) by director2.derp.mail-out.ovh.net (Postfix) with ESMTPS id 4bNCfv0BY8z1yVR; Thu, 19 Jun 2025 07:59:03 +0000 (UTC) Received: from ngraves.fr (unknown [10.1.6.5]) by mta7.priv.ovhmail-u1.ea.mail.ovh.net (Postfix) with ESMTPSA id 8EA48C3CAF; Thu, 19 Jun 2025 07:59:02 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-108S002078c0bf1-aafb-4213-93cc-d86e93aa8fb8, 129058C0FBD5227E7F6EF83700C8F3C5E5DC00BA) smtp.auth=ngraves@ngraves.fr X-OVh-ClientIp: 80.215.169.212 Date: Thu, 19 Jun 2025 09:58:48 +0200 Message-ID: <20250619075859.10878-2-ngraves@ngraves.fr> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250619075859.10878-1-ngraves@ngraves.fr> References: <20250619075859.10878-1-ngraves@ngraves.fr> MIME-Version: 1.0 X-Ovh-Tracer-Id: 14071215564170584802 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeffedrtddvgdegleekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepvedvfffhueeihfehheelgefgkefgieeljeeglefhffeghfehffeggedvleeggeeunecuffhomhgrihhnpehphihthhhonhdrohhrghdpphihphgrrdhiohenucfkphepuddvjedrtddrtddruddpkedtrddvudehrdduieelrddvuddvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpehnghhrrghvvghssehnghhrrghvvghsrdhfrhdpnhgspghrtghpthhtohepvddprhgtphhtthhopeejkeekvdekseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepnhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrpdfovfetjfhoshhtpehmohehieefmgdpmhhouggvpehsmhhtphhouhht DKIM-Signature: a=rsa-sha256; bh=KLSB1lKct6DBF2Qtr28RX/O3DchTtTmriIE/WHC1sUc=; c=relaxed/relaxed; d=ngraves.fr; h=From; s=ovhmo4487190-selector1; t=1750319943; v=1; b=y0TTe75dz64Hrk8lZA2a+HhE5CC1XbRZSDvpt5UhcKud2MSxlIR6Kkj0raKWhCXJgwDU+2je Hq64DLnYquW0Fg//gDFDzlYp37ogr0j7jKl5LLW09sz66CCthyZMRB2SZk6NYfnvCEJrbPUGeeA sk8AHh1vUBYjVE80Dt3UcPJ9Q4wM2fFRw6N3+NSvSNng/cVY/cISsEeXMxezz58lTeZgwMyuFCq lBTy7OeRXo5y12WkGB3SPuVeO22XCuGM8BLuU8WLR1plCKBdR8oiSTJayhkPJBMof0aGHJ8fIHo tEY+vPwaLaoc2FBpTBBR7qFbrFxUptTi5Zx0/JAIbDyLw== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Nicolas Graves X-ACL-Warn: , Nicolas Graves via Guix-patches X-Patchwork-Original-From: Nicolas Graves via Guix-patches via From: Nicolas Graves Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/build-system/pyproject.scm (check): Add stestr, unittest and custom test-backends. --- guix/build/pyproject-build-system.scm | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/guix/build/pyproject-build-system.scm b/guix/build/pyproject-build-system.scm index 1b66dce99c..1fa610faa9 100644 --- a/guix/build/pyproject-build-system.scm +++ b/guix/build/pyproject-build-system.scm @@ -150,18 +150,26 @@ (define* (check #:key tests? test-backend test-flags #:allow-other-keys) (let* ((pytest (which "pytest")) (nosetests (which "nosetests")) (nose2 (which "nose2")) + (stestr (which "stestr")) (have-setup-py (file-exists? "setup.py")) + ;; unittest default pattern + ;; See https://docs.python.org/3/library/unittest.html\ + ;; #cmdoption-unittest-discover-p + (tests-found (find-files "." "test.*\\.py$")) (use-test-backend (or test-backend ;; Prefer pytest (if pytest 'pytest #f) + (if stestr 'stestr #f) (if nosetests 'nose #f) (if nose2 'nose2 #f) - ;; But fall back to setup.py, which should work for most - ;; packages. XXX: would be nice not to depend on setup.py here? - ;; fails more often than not to find any tests at all. Maybe - ;; we can run `python -m unittest`? - (if have-setup-py 'setup.py #f)))) + ;; Fall back to setup.py. The command is deprecated, but is + ;; a superset of unittest, so should work for most packages. + ;; Keep it until setuptools removes `setup.py test'. + ;; See https://setuptools.pypa.io/en/latest/deprecated/\ + ;; commands.html#test-build-package-and-run-a-unittest-suite + (if have-setup-py 'setup.py #f) + (if tests-found 'unittest #f)))) (format #t "Using ~a~%" use-test-backend) (match use-test-backend ('pytest @@ -175,7 +183,11 @@ (define* (check #:key tests? test-backend test-flags #:allow-other-keys) (if (null? test-flags) '("test" "-v") test-flags))) - ('python + ('stestr + (apply invoke stestr "run" test-flags)) + ('unittest + (apply invoke "python" "-m" "unittest" test-flags)) + ('custom (apply invoke "python" test-flags)) ;; The developer should explicitly disable tests in this case. (else (raise (condition (&test-system-not-found))))))