diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-01-25 13:26:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-01-25 13:26:35 +0000 |
commit | 4fee3e091a8d79a40f70ff9c1f87b29b9340049a (patch) | |
tree | 465ad9629a8ee56548bd6c51c3fc710907564911 /qa/test_stdin.py | |
parent | Releasing debian version 0.14.0-1. (diff) | |
download | gitlint-4fee3e091a8d79a40f70ff9c1f87b29b9340049a.tar.xz gitlint-4fee3e091a8d79a40f70ff9c1f87b29b9340049a.zip |
Merging upstream version 0.15.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'qa/test_stdin.py')
-rw-r--r-- | qa/test_stdin.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/qa/test_stdin.py b/qa/test_stdin.py index fff636f..18d6e7e 100644 --- a/qa/test_stdin.py +++ b/qa/test_stdin.py @@ -4,7 +4,7 @@ import io import subprocess from qa.shell import echo, gitlint from qa.base import BaseTestCase -from qa.utils import ustr, DEFAULT_ENCODING +from qa.utils import DEFAULT_ENCODING class StdInTests(BaseTestCase): @@ -18,7 +18,7 @@ class StdInTests(BaseTestCase): # NOTE: There is no use in testing this with _tty_in=True, because if you pipe something into a command # there never is a TTY connected to stdin (per definition). We're setting _tty_in=False here to be explicit # but note that this is always true when piping something into a command. - output = gitlint(echo(u"WIP: Pïpe test."), + output = gitlint(echo("WIP: Pïpe test."), _cwd=self.tmp_git_repo, _tty_in=False, _err_to_out=True, _ok_code=[3]) self.assertEqualStdout(output, self.get_expected("test_stdin/test_stdin_pipe_1")) @@ -28,7 +28,7 @@ class StdInTests(BaseTestCase): This is the equivalent of doing: $ echo -n "" | gitlint """ - commit_msg = u"WIP: This ïs a title.\nContent on the sëcond line" + commit_msg = "WIP: This ïs a title.\nContent on the sëcond line" self.create_simple_commit(commit_msg) # We need to set _err_to_out explicitly for sh to merge stdout and stderr output in case there's @@ -36,21 +36,21 @@ 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(ustr(output), self.get_expected("test_stdin/test_stdin_pipe_empty_1")) + self.assertEqual(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) This is the equivalent of doing: $ gitlint < myfile """ - tmp_commit_msg_file = self.create_tmpfile(u"WIP: STDIN ïs a file test.") + tmp_commit_msg_file = self.create_tmpfile("WIP: STDIN ïs a file test.") with io.open(tmp_commit_msg_file, encoding=DEFAULT_ENCODING) as file_handle: # 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. - p = subprocess.Popen(u"gitlint", stdin=file_handle, cwd=self.tmp_git_repo, + p = subprocess.Popen("gitlint", stdin=file_handle, cwd=self.tmp_git_repo, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) output, _ = p.communicate() - self.assertEqual(ustr(output), self.get_expected("test_stdin/test_stdin_file_1")) + self.assertEqual(output.decode(DEFAULT_ENCODING), self.get_expected("test_stdin/test_stdin_file_1")) |