diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-03-11 08:03:07 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-03-11 08:03:07 +0000 |
commit | dcc28a9a987457acf9e2c8249a9df5e40143eba3 (patch) | |
tree | a3b44db00ff34f0dee0406875e7320c4dce3041e /qa/test_stdin.py | |
parent | Releasing debian version 0.19.0~dev-1. (diff) | |
download | gitlint-dcc28a9a987457acf9e2c8249a9df5e40143eba3.tar.xz gitlint-dcc28a9a987457acf9e2c8249a9df5e40143eba3.zip |
Merging upstream version 0.19.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | qa/test_stdin.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/qa/test_stdin.py b/qa/test_stdin.py index 8ed4cb1..04a3de9 100644 --- a/qa/test_stdin.py +++ b/qa/test_stdin.py @@ -1,8 +1,8 @@ -# pylint: disable=too-many-function-args,unexpected-keyword-arg import subprocess -from qa.shell import echo, gitlint + from qa.base import BaseTestCase -from qa.utils import DEFAULT_ENCODING +from qa.shell import echo, gitlint +from qa.utils import FILE_ENCODING, TERMINAL_ENCODING class StdInTests(BaseTestCase): @@ -33,7 +33,7 @@ class StdInTests(BaseTestCase): # http://amoffat.github.io/sh/sections/special_arguments.html?highlight=_tty_in#err-to-out output = gitlint(echo("-n", ""), _cwd=self.tmp_git_repo, _tty_in=False, _err_to_out=True, _ok_code=[3]) - self.assertEqual(output, self.get_expected("test_stdin/test_stdin_pipe_empty_1")) + self.assertEqualStdout(output, self.get_expected("test_stdin/test_stdin_pipe_empty_1")) def test_stdin_file(self): """Test the scenario where STDIN is a regular file (stat.S_ISREG = True) @@ -42,7 +42,7 @@ class StdInTests(BaseTestCase): """ tmp_commit_msg_file = self.create_tmpfile("WIP: STDIN ïs a file test.") - with open(tmp_commit_msg_file, encoding=DEFAULT_ENCODING) as file_handle: + with open(tmp_commit_msg_file, encoding=FILE_ENCODING) as file_handle: # noqa: SIM117 # We need to use subprocess.Popen() here instead of sh because when passing a file_handle to sh, it will # deal with reading the file itself instead of passing it on to gitlint as a STDIN. Since we're trying to # test for the condition where stat.S_ISREG == True that won't work for us here. @@ -50,4 +50,4 @@ class StdInTests(BaseTestCase): "gitlint", stdin=file_handle, cwd=self.tmp_git_repo, stdout=subprocess.PIPE, stderr=subprocess.STDOUT ) as p: output, _ = p.communicate() - self.assertEqual(output.decode(DEFAULT_ENCODING), self.get_expected("test_stdin/test_stdin_file_1")) + self.assertEqual(output.decode(TERMINAL_ENCODING), self.get_expected("test_stdin/test_stdin_file_1")) |