diff options
author | Joris Roovers <jroovers@cisco.com> | 2018-04-01 16:23:29 +0200 |
---|---|---|
committer | Joris Roovers <jroovers@cisco.com> | 2018-04-01 16:23:29 +0200 |
commit | 52dc67e751dbbaa66c455063c6fe4f2f86d668d4 (patch) | |
tree | 2ddebe945e6664f763283a3f3c6d4fc895d92c1a /qa | |
parent | 7d447959e4220428d929c4aa1310675bb9e3bee1 (diff) |
Integration test + docs for ignore-by-title rule
Added integration tests and documentation for the new ignore-by-title rule.
Also added '--ignore-requires-python' to pip installs in run_tests.sh to
deal with some python 2.6 and 3.3 issues.
Diffstat (limited to 'qa')
-rw-r--r-- | qa/samples/config/ignore-release-commits | 3 | ||||
-rw-r--r-- | qa/test_commits.py | 30 |
2 files changed, 33 insertions, 0 deletions
diff --git a/qa/samples/config/ignore-release-commits b/qa/samples/config/ignore-release-commits new file mode 100644 index 0000000..898e73f --- /dev/null +++ b/qa/samples/config/ignore-release-commits @@ -0,0 +1,3 @@ +[ignore-by-title] +regex=^Release(.*) +ignore=T5,T3
\ No newline at end of file diff --git a/qa/test_commits.py b/qa/test_commits.py index be0a8fd..0d306e1 100644 --- a/qa/test_commits.py +++ b/qa/test_commits.py @@ -73,3 +73,33 @@ class CommitsTests(BaseTestCase): ) self.assertEqual(output, expected) + + def test_ignore_commits(self): + """ Tests multiple commits of which some rules get igonored because of ignore-* rules """ + # Create repo and some commits + tmp_git_repo = self.create_tmp_git_repo() + self._create_simple_commit(u"Sïmple title.\n\nSimple bödy describing the commit", git_repo=tmp_git_repo) + # Normally, this commit will give T3 (trailing-punctuation), T5 (WIP) and B5 (bod-too-short) violations + # But in this case only B5 because T3 and T5 are being ignored because of config + self._create_simple_commit(u"Release: WIP tïtle.\n\nShort", git_repo=tmp_git_repo) + # In the following 2 commits, the T3 violations are as normal + self._create_simple_commit(u"Sïmple title3.\n\nSimple bödy describing the commit3", git_repo=tmp_git_repo) + self._create_simple_commit(u"Sïmple title4.\n\nSimple bödy describing the commit4", git_repo=tmp_git_repo) + revlist = git("rev-list", "HEAD", _err_to_out=True, _cwd=tmp_git_repo).split() + + config_path = self.get_sample_path("config/ignore-release-commits") + output = gitlint("--commits", "HEAD", "--config", config_path, _cwd=tmp_git_repo, + _tty_in=False, _err_to_out=True, _ok_code=[4]) + + expected = ( + u"Commit {0}:\n".format(revlist[0][:10]) + + u"1: T3 Title has trailing punctuation (.): \"Sïmple title4.\"\n\n" + + u"Commit {0}:\n".format(revlist[1][:10]) + + u"1: T3 Title has trailing punctuation (.): \"Sïmple title3.\"\n\n" + + u"Commit {0}:\n".format(revlist[2][:10]) + + u"3: B5 Body message is too short (5<20): \"Short\"\n\n" + + u"Commit {0}:\n".format(revlist[3][:10]) + + u"1: T3 Title has trailing punctuation (.): \"Sïmple title.\"\n" + ) + + self.assertEqual(output, expected) |