[git-buildpackage] [PATCH master v2] gbp-dch: allow bug number format to be overridden
Guido Günther
agx at sigxcpu.org
Thu Aug 27 08:58:26 CEST 2015
Hi,
Thanks for updating the docs the tests...
On Wed, Aug 26, 2015 at 07:15:19PM -0400, Jonathan Toppins wrote:
> diff --git a/tests/11_test_dch_main.py b/tests/11_test_dch_main.py
> index 8f7d9bf..7e2a197 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)
> +
p> +
> + 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)
... are nice to test the full code path but I was initially thinking
more in the lines of testing extract_bts_cmds() directly so we can
easily verify it's working as designed (and easily identify the unit
under test). You can simply feed a lines array and a options stubbed
class (like in 13_test_gbp_pq.py) and then check the return value
(contents of commands and other_lines) afterwards.
Can you turn your current tests into direct tests of extract_bts_cmds()
as described above? You can create a 23_test_dch_extract_bts_cmds.py
for that. (and feel free to keep the above in 11_test_dch_main as well).
Cheers and thanks for your work on gbp,
-- Guido
More information about the git-buildpackage
mailing list