From patchwork Thu Feb 27 14:27:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Graves X-Patchwork-Id: 39382 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 2F9AF27BBE9; Thu, 27 Feb 2025 14:38:49 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable 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 7DBB827BBE2 for ; Thu, 27 Feb 2025 14:38:47 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tnf15-0002V6-I3; Thu, 27 Feb 2025 09:37:37 -0500 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 1tnezo-0007q9-W1 for guix-patches@gnu.org; Thu, 27 Feb 2025 09:36:21 -0500 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 1tnezo-000712-Ko for guix-patches@gnu.org; Thu, 27 Feb 2025 09:36:16 -0500 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=Vn8t2fbeij07XxNapKzdxFqcZ3I39TxKUJORmB6sp+A=; b=k+OcET9uPjKTRseSehNdBfg89jeQO4w9ea2tkI0rNVvOmYRK74CqPSPIivg5NWN2qZK+l8a/X503DDXGP3uQ4h3/G7XrdmJ18S/SE7ZwRnZVfnTIEdMUKUHsRcW6Ntr6s9SBc3icN729saZb5ql6Y/NTyorX4FhwMYOm4w6vQ/JH2BQjtWHJD031Ld5xtRjvQ5dagI4IExgKKxIh+f2TD+zO1HvvrCGv4eSXGDC/omePQ8qawLt92c4OO7VO5v56WKf5MzBPV7ZEEgT4LMzu6hR08x0Zbu47yWq2B0AghEyTCJG1TbhrH1Cv6FH5i+xLLTINVSdEft3gu05O9oayeQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tnezo-0001LT-F2 for guix-patches@gnu.org; Thu, 27 Feb 2025 09:36:16 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#70858] [PATCH v5 36/48] build-system/pyproject: Add option #:use-pytest-plugin? Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 27 Feb 2025 14:36:16 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70858 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70858@debbugs.gnu.org Cc: Nicolas Graves Received: via spool by 70858-submit@debbugs.gnu.org id=B70858.17406669665024 (code B ref 70858); Thu, 27 Feb 2025 14:36:16 +0000 Received: (at 70858) by debbugs.gnu.org; 27 Feb 2025 14:36:06 +0000 Received: from localhost ([127.0.0.1]:32841 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tnezc-0001IZ-89 for submit@debbugs.gnu.org; Thu, 27 Feb 2025 09:36:05 -0500 Received: from 4.mo560.mail-out.ovh.net ([87.98.172.75]:34445) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tnevA-0000fq-Na for 70858@debbugs.gnu.org; Thu, 27 Feb 2025 09:31:31 -0500 Received: from director5.ghost.mail-out.ovh.net (unknown [10.108.17.93]) by mo560.mail-out.ovh.net (Postfix) with ESMTP id 4Z3YgL6NBsz1YMt for <70858@debbugs.gnu.org>; Thu, 27 Feb 2025 14:31:26 +0000 (UTC) Received: from ghost-submission-5b5ff79f4f-ksmhf (unknown [10.110.168.127]) by director5.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 919D11FEC9; Thu, 27 Feb 2025 14:31:26 +0000 (UTC) Received: from ngraves.fr ([37.59.142.109]) by ghost-submission-5b5ff79f4f-ksmhf with ESMTPSA id 1jBdFj53wGdp9AQA42wEQQ (envelope-from ); Thu, 27 Feb 2025 14:31:26 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-109S003be151465-8f59-47e9-b604-324b166275dd, 852F381DE14AD356CABD73FF6ED6F710EC841544) smtp.auth=ngraves@ngraves.fr X-OVh-ClientIp: 176.140.199.36 Date: Thu, 27 Feb 2025 15:27:37 +0100 Message-ID: <20250227143028.12499-37-ngraves@ngraves.fr> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250227143028.12499-1-ngraves@ngraves.fr> References: <20250227143028.12499-1-ngraves@ngraves.fr> MIME-Version: 1.0 X-Ovh-Tracer-Id: 8592305141860066018 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdekjeejudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecunecujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomheppfhitgholhgrshcuifhrrghvvghsuceonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqeenucggtffrrghtthgvrhhnpeelffejteeutefhfeekfffffedvudekjeekgfeludeitdfhkeevhfeivdfhffeggeenucfkphepuddvjedrtddrtddruddpudejiedrudegtddrudelledrfeeipdefjedrheelrddugedvrddutdelnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpehnghhrrghvvghssehnghhrrghvvghsrdhfrhdpnhgspghrtghpthhtohepuddprhgtphhtthhopeejtdekheekseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehiedtmgdpmhhouggvpehsmhhtphhouhht DKIM-Signature: a=rsa-sha256; bh=Vn8t2fbeij07XxNapKzdxFqcZ3I39TxKUJORmB6sp+A=; c=relaxed/relaxed; d=ngraves.fr; h=From; s=ovhmo4487190-selector1; t=1740666687; v=1; b=0XdflraFZbHg+HEo+MGsNt3F+xW8hbLc9bWXTeT85qRde5l3xTpHcuRzIBZptIZaGyDN0v0y hW2RQZomAbhact4frP65ZWI8Fr5wvlpWrN9llRauRmW0bWnVzDNcbl3JYeiShohsGuS9kO+yw6I 0SvIpVg3DPkiBKZTcZ2GfA8JWY0rPTsMB9sKEEGMhXkFPZpIK6+mTJb0+BHRy6WDrbBZHcnHInc mUQy19uhNH8zCzBYMCaSIdXayxzpoYwK/f6e6e3yeMVo8IaVQBFblWCV8faoVT6aVxIDbGs08fq pHuoZz/7AqlbcbjYZrk5jFeLhfo/oOkNEB1iB4kuF9ICg== 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 In the very rare cases where our plugin actually breaks a test, adding a flag is more convenient than replacing the phase. * guix/build-system/pyproject.scm (pyproject-build): Add option use-pytest-plugin? * guix/build/pyproject-build-system.scm (check): Add and use option use-pytest-plugin? * gnu/packages/check.scm (python-coverage, python-pytest-mypy)[arguments]{use-pytest-plugin}: Set to #f to fix tests. * gnu/packages/python-check.scm (python-pytest-flake8)[arguments]: Likewise. --- gnu/packages/check.scm | 6 +++++- gnu/packages/python-check.scm | 1 + guix/build-system/pyproject.scm | 2 ++ guix/build/pyproject-build-system.scm | 9 ++++++--- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm index 3c9373648f..5bb5edd369 100644 --- a/gnu/packages/check.scm +++ b/gnu/packages/check.scm @@ -2500,6 +2500,8 @@ (define-public python-coverage "--deselect=tests/test_filereporter.py::FileReporterTest::test_zipfile" ;; XXX: Checking coverage for too much files, not only the target one. "--deselect=tests/test_oddball.py::DoctestTest::test_doctest") + ;; This is one of the rare cases where our plugin causes a test to fail. + #:use-pytest-plugin? #f #:phases #~(modify-phases %standard-phases (add-after 'unpack 'patch-pyproject @@ -2997,7 +2999,9 @@ (define-public python-pytest-mypy (build-system pyproject-build-system) (arguments (list - #:test-flags #~(list "--numprocesses" "auto"))) + #:use-pytest-plugin? #f + #:test-flags #~(list "--numprocesses" + (number->string (parallel-job-count))))) (native-inputs (list python-pexpect python-pytest-xdist diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm index ac9243b8f4..bbf3e47655 100644 --- a/gnu/packages/python-check.scm +++ b/gnu/packages/python-check.scm @@ -1704,6 +1704,7 @@ (define-public python-pytest-flake8 (base32 "1rhz7mxcg7x9dbabfcjai3zxikfgw7az07m4ddf92bg35ib3byw8")))) (build-system pyproject-build-system) + (arguments (list #:use-pytest-plugin? #f)) (native-inputs (list python-pytest python-setuptools diff --git a/guix/build-system/pyproject.scm b/guix/build-system/pyproject.scm index bdf8f440ac..1cd38ce349 100644 --- a/guix/build-system/pyproject.scm +++ b/guix/build-system/pyproject.scm @@ -93,6 +93,7 @@ (define private-keywords (define* (pyproject-build name inputs #:key source (tests? #t) + (use-pytest-plugin? #t) (configure-flags ''(@)) (backend-path #f) (build-backend #f) @@ -125,6 +126,7 @@ (define build #:test-backend #$test-backend #:test-flags #$test-flags #:tests? #$tests? + #:use-pytest-plugin? #$use-pytest-plugin? #:phases #$(if (pair? phases) (sexp->gexp phases) phases) diff --git a/guix/build/pyproject-build-system.scm b/guix/build/pyproject-build-system.scm index 2df9f2f479..a96ec05ad6 100644 --- a/guix/build/pyproject-build-system.scm +++ b/guix/build/pyproject-build-system.scm @@ -231,7 +231,8 @@ (define-syntax-rule (with-guix-pytest-plugin inputs exp ...) "Evaluate EXP in a context where the Guix pytest plugin is added." (call-with-guix-pytest-plugin inputs (lambda () exp ...))) -(define* (check #:key inputs tests? test-backend test-flags #:allow-other-keys) +(define* (check #:key inputs tests? test-backend test-flags use-pytest-plugin? + #:allow-other-keys) "Run the test suite of a given Python package." (if tests? ;; Unfortunately with PEP 517 there is no common method to specify test @@ -254,8 +255,10 @@ (define* (check #:key inputs tests? test-backend test-flags #:allow-other-keys) (format #t "Using ~a~%" use-test-backend) (match use-test-backend ('pytest - (with-guix-pytest-plugin inputs - (apply invoke pytest "-vv" test-flags))) + (if use-pytest-plugin? + (with-guix-pytest-plugin inputs + (apply invoke pytest "-vv" test-flags)) + (apply invoke pytest "-vv" test-flags))) ('nose (apply invoke nosetests "-v" test-flags)) ('nose2