public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Arthur Zamarin" <arthurzam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pkgcore/pkgdev:main commit in: tests/scripts/
Date: Sat, 20 Jul 2024 15:37:33 +0000 (UTC)	[thread overview]
Message-ID: <1721489842.3a4a1f3b000d297f6bc9ab6b44e68d991e74b28c.arthurzam@gentoo> (raw)

commit:     3a4a1f3b000d297f6bc9ab6b44e68d991e74b28c
Author:     Lucio Sauer <watermanpaint <AT> posteo <DOT> net>
AuthorDate: Sat Jul 20 15:02:16 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> 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 <watermanpaint <AT> posteo.net>
Signed-off-by: Arthur Zamarin <arthurzam <AT> 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:


             reply	other threads:[~2024-07-20 15:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-20 15:37 Arthur Zamarin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-01-26 20:22 [gentoo-commits] proj/pkgcore/pkgdev:main commit in: tests/scripts/ Arthur Zamarin
2023-12-29 12:32 Arthur Zamarin
2023-05-28 19:41 Arthur Zamarin
2022-11-19 17:22 Arthur Zamarin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1721489842.3a4a1f3b000d297f6bc9ab6b44e68d991e74b28c.arthurzam@gentoo \
    --to=arthurzam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox