From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id EB406158170 for ; Sat, 20 Jul 2024 15:37:36 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 421B72BC06A; Sat, 20 Jul 2024 15:37:36 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 25EB62BC06A for ; Sat, 20 Jul 2024 15:37:36 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3FB66342FF7 for ; Sat, 20 Jul 2024 15:37:35 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D1C481CC0 for ; Sat, 20 Jul 2024 15:37:33 +0000 (UTC) From: "Arthur Zamarin" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arthur Zamarin" Message-ID: <1721489842.3a4a1f3b000d297f6bc9ab6b44e68d991e74b28c.arthurzam@gentoo> Subject: [gentoo-commits] proj/pkgcore/pkgdev:main commit in: tests/scripts/ X-VCS-Repository: proj/pkgcore/pkgdev X-VCS-Files: tests/scripts/test_pkgdev_commit.py X-VCS-Directories: tests/scripts/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: 3a4a1f3b000d297f6bc9ab6b44e68d991e74b28c X-VCS-Branch: main Date: Sat, 20 Jul 2024 15:37:33 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 557b138f-d65e-4de3-a6c0-fdc70209ccaf X-Archives-Hash: 1ca5c14004e3eabe2da6f397b0ac6cb9 commit: 3a4a1f3b000d297f6bc9ab6b44e68d991e74b28c Author: Lucio Sauer posteo net> AuthorDate: Sat Jul 20 15:02:16 2024 +0000 Commit: Arthur Zamarin gentoo org> CommitDate: Sat Jul 20 15:37:22 2024 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgdev.git/commit/?id=3a4a1f3b tests: add tests for Closes tags with resolution Signed-off-by: Lucio Sauer posteo.net> Signed-off-by: Arthur Zamarin gentoo.org> tests/scripts/test_pkgdev_commit.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/scripts/test_pkgdev_commit.py b/tests/scripts/test_pkgdev_commit.py index ff93db8..04fc16a 100644 --- a/tests/scripts/test_pkgdev_commit.py +++ b/tests/scripts/test_pkgdev_commit.py @@ -152,6 +152,36 @@ class TestPkgdevCommitParseArgs: options, _ = tool.parse_args(["commit", opt, "https://bugs.gentoo.org/2"]) assert options.footer == {("Closes", "https://bugs.gentoo.org/2")} + # bug IDs and URLs with good resolutions + for opt in ("-c", "--closes"): + for values, expected in ( + (("", "FIXED", "fiXed"), ""), + (("PKGREMOVED", "pkgRemovEd"), " (pkgremoved)"), + (("OBSOLETE", "obSoleTe"), " (obsolete)"), + ): + for value in values: + for bug in "1", "https://bugs.gentoo.org/1": + options, _ = tool.parse_args(["commit", opt, f"{bug}:{value}"]) + assert options.footer == { + ("Closes", f"https://bugs.gentoo.org/1{expected}") + } + + # bad bug-resolution pair + for opt in ("-c", "--closes"): + for value, expected in ( + (":", "invalid commit tag"), + (":1", "invalid commit tag"), + (":fixed", "invalid commit tag"), + ("1:invalid", "should be one of"), + ("https://bugs.gentoo.org/1:invalid", "should be one of"), + ): + with pytest.raises(SystemExit) as excinfo: + options, _ = tool.parse_args(["commit", opt, value]) + assert excinfo.value.code == 2 + out, err = capsys.readouterr() + assert not out + assert expected in err + # bad URL for opt in ("-b", "-c"): with pytest.raises(SystemExit) as excinfo: