aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/11_test_dch_main.py
diff options
context:
space:
mode:
authorJonathan Toppins <jtoppins@cumulusnetworks.com>2015-08-27 10:09:37 -0400
committerGuido Günther <agx@sigxcpu.org>2015-08-27 19:40:35 +0200
commitc89c29d3584d8e6e4a25eb434849f93b14897485 (patch)
tree8048290a7fcd15b5903c2edafcb49914265c5bdf /tests/11_test_dch_main.py
parent488ba325db7d467d813c4966354676e1f943988d (diff)
gbp-dch: allow bug number format to be overridden
Some derivatives and non Debian exclusive projects don't use just numbers for their bug numbers. gbp-dch should still be able to parse these bug numbers and generate useful changelog entries. This doesn't solve dpkg-parsechangelog but is a start. Examples of non-Debian bug numbers are: example change header Example: EX-12345 Should produce the following change log: * example change header (Example: EX-12345) This also helps in pulling CVE numbers simply by letting the user modify the regex to something like 'cve-\d+-\d+'. Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com> Signed-off-by: Guido Günther <agx@sigxcpu.org>
Diffstat (limited to 'tests/11_test_dch_main.py')
-rw-r--r--tests/11_test_dch_main.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/11_test_dch_main.py b/tests/11_test_dch_main.py
index 8f7d9bf2..7e2a197d 100644
--- a/tests/11_test_dch_main.py
+++ b/tests/11_test_dch_main.py
@@ -364,3 +364,38 @@ class TestScriptDch(DebianGitTestRepo):
self.assertEqual(header.lastindex, 1)
self.assertIsNotNone(re.search(snap_mark + header.group(1), lines[2]))
self.assertIn(""" * added debian/control\n""", lines)
+
+
+ def test_dch_main_closes_default(self):
+ options = ["--meta"]
+ self.add_file("closes", "test file",
+ msg="""test debian closes commit\n\nCloses: #123456""")
+ lines = self.run_dch(options)
+ self.assertIn(""" * test debian closes commit (Closes: #123456)\n""",
+ lines)
+
+
+ def test_dch_main_closes_non_debian_bug_numbers(self):
+ self.add_file("closes", "test file",
+ msg="""test non-debian closes 1\n\nCloses: EX-123""")
+ self.add_file("closes1", "test file",
+ msg="""test non-debian closes 2\n\nCloses: EX-5678""")
+ options = ["--meta", '--meta-closes-bugnum=ex-\d+']
+ lines = self.run_dch(options)
+ self.assertIn(""" * test non-debian closes 1 (Closes: EX-123)\n""",
+ lines)
+ self.assertIn(""" * test non-debian closes 2 (Closes: EX-5678)\n""",
+ lines)
+
+ def test_dch_main_meta_closes_and_bug_numbers(self):
+ self.add_file("closes", "test file",
+ msg="""test non-debian closes 1\n\nExample: EX-123""")
+ self.add_file("closes1", "test file",
+ msg="""test non-debian closes 2\n\nExample: EX-5678""")
+ options = ["--meta", '--meta-closes-bugnum=ex-\d+',
+ '--meta-closes=Example']
+ lines = self.run_dch(options)
+ self.assertIn(""" * test non-debian closes 1 (Example: EX-123)\n""",
+ lines)
+ self.assertIn(""" * test non-debian closes 2 (Example: EX-5678)\n""",
+ lines)