summaryrefslogtreecommitdiffstats
path: root/qa/test_user_defined.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-11-19 14:52:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-11-19 14:52:46 +0000
commita2aa51f5702b18016c25d943499941323952704d (patch)
tree7ee43f79639ee53903e7ca389e548974e1497c3a /qa/test_user_defined.py
parentAdding upstream version 0.17.0. (diff)
downloadgitlint-a2aa51f5702b18016c25d943499941323952704d.tar.xz
gitlint-a2aa51f5702b18016c25d943499941323952704d.zip
Adding upstream version 0.18.0.upstream/0.18.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'qa/test_user_defined.py')
-rw-r--r--qa/test_user_defined.py31
1 files changed, 20 insertions, 11 deletions
diff --git a/qa/test_user_defined.py b/qa/test_user_defined.py
index 378ab36..a003f3e 100644
--- a/qa/test_user_defined.py
+++ b/qa/test_user_defined.py
@@ -1,14 +1,13 @@
-# -*- coding: utf-8 -*-
# pylint: disable=too-many-function-args,unexpected-keyword-arg
from qa.shell import gitlint
from qa.base import BaseTestCase
class UserDefinedRuleTests(BaseTestCase):
- """ Integration tests for user-defined rules."""
+ """Integration tests for user-defined rules."""
def test_user_defined_rules_examples1(self):
- """ Test the user defined rules in the top-level `examples/` directory """
+ """Test the user defined rules in the top-level `examples/` directory"""
extra_path = self.get_example_path()
commit_msg = "WIP: Thi$ is å title\nContent on the second line"
self.create_simple_commit(commit_msg)
@@ -16,7 +15,7 @@ class UserDefinedRuleTests(BaseTestCase):
self.assertEqualStdout(output, self.get_expected("test_user_defined/test_user_defined_rules_examples_1"))
def test_user_defined_rules_examples2(self):
- """ Test the user defined rules in the top-level `examples/` directory """
+ """Test the user defined rules in the top-level `examples/` directory"""
extra_path = self.get_example_path()
commit_msg = "Release: Thi$ is å title\nContent on the second line\n$This line is ignored \nThis isn't\t\n"
self.create_simple_commit(commit_msg)
@@ -24,12 +23,19 @@ class UserDefinedRuleTests(BaseTestCase):
self.assertEqualStdout(output, self.get_expected("test_user_defined/test_user_defined_rules_examples_2"))
def test_user_defined_rules_examples_with_config(self):
- """ Test the user defined rules in the top-level `examples/` directory """
+ """Test the user defined rules in the top-level `examples/` directory"""
extra_path = self.get_example_path()
commit_msg = "WIP: Thi$ is å title\nContent on the second line"
self.create_simple_commit(commit_msg)
- output = gitlint("--extra-path", extra_path, "-c", "body-max-line-count.max-line-count=1",
- _cwd=self.tmp_git_repo, _tty_in=True, _ok_code=[6])
+ output = gitlint(
+ "--extra-path",
+ extra_path,
+ "-c",
+ "body-max-line-count.max-line-count=1",
+ _cwd=self.tmp_git_repo,
+ _tty_in=True,
+ _ok_code=[6],
+ )
expected_path = "test_user_defined/test_user_defined_rules_examples_with_config_1"
self.assertEqualStdout(output, self.get_expected(expected_path))
@@ -38,12 +44,15 @@ class UserDefinedRuleTests(BaseTestCase):
commit_msg = "WIP: Thi$ is å title\nContent on the second line"
self.create_simple_commit(commit_msg)
output = gitlint("--extra-path", extra_path, _cwd=self.tmp_git_repo, _tty_in=True, _ok_code=[9])
- self.assertEqualStdout(output, self.get_expected("test_user_defined/test_user_defined_rules_extra_1",
- {'repo-path': self.tmp_git_repo}))
+ self.assertEqualStdout(
+ output,
+ self.get_expected("test_user_defined/test_user_defined_rules_extra_1", {"repo-path": self.tmp_git_repo}),
+ )
def test_invalid_user_defined_rules(self):
extra_path = self.get_sample_path("user_rules/incorrect_linerule")
self.create_simple_commit("WIP: test")
output = gitlint("--extra-path", extra_path, _cwd=self.tmp_git_repo, _tty_in=True, _ok_code=[255])
- self.assertEqualStdout(output,
- "Config Error: User-defined rule class 'MyUserLineRule' must have a 'validate' method\n")
+ self.assertEqualStdout(
+ output, "Config Error: User-defined rule class 'MyUserLineRule' must have a 'validate' method\n"
+ )