Merging upstream version 0.19.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
61e6dccee9
commit
2efee3d3ab
111 changed files with 2058 additions and 1676 deletions
|
@ -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"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue