From e287fa760bb783a54a0299998cfba585356868fc Mon Sep 17 00:00:00 2001 From: Daniel Kutik Date: Sun, 27 Nov 2022 13:42:50 +0100 Subject: [PATCH] test_capture: allow both Unix and Windows line sep On Linux/macOS we allow \n in the end of the line. On Windows we allow both \r\n and \n. Here we also allow Unix line seperators as tests might be excuted in for example git-shell. Change-Id: I3975b563cf95407da92e5479980e670eb748b30e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/353181 Tested-by: Daniel Kutik Reviewed-by: Mike Frysinger --- tests/test_wrapper.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_wrapper.py b/tests/test_wrapper.py index 8447bec1..f77ae1ef 100644 --- a/tests/test_wrapper.py +++ b/tests/test_wrapper.py @@ -159,7 +159,9 @@ class RunCommand(RepoWrapperTestCase): def test_capture(self): """Check capture_output handling.""" ret = self.wrapper.run_command(['echo', 'hi'], capture_output=True) - self.assertEqual(ret.stdout, 'hi\n') + # echo command appends OS specific linesep, but on Windows + Git Bash + # we get UNIX ending, so we allow both. + self.assertIn(ret.stdout, ['hi' + os.linesep, 'hi\n']) def test_check(self): """Check check handling."""