61 lines
2.6 KiB
Diff
61 lines
2.6 KiB
Diff
From 247a7480aaa4b0d71289855f8fd8e1ae566b092b Mon Sep 17 00:00:00 2001
|
|
From: Scott K Logan <logans@cottsay.net>
|
|
Date: Sun, 10 May 2020 02:24:12 -0700
|
|
Subject: [PATCH] Make tests compatible with git back to 1.8.3.1
|
|
|
|
---
|
|
test/test_commands.py | 26 ++++++++++++++++++++++++--
|
|
1 file changed, 24 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/test/test_commands.py b/test/test_commands.py
|
|
index 6374b3d..eff1b82 100644
|
|
--- a/test/test_commands.py
|
|
+++ b/test/test_commands.py
|
|
@@ -92,7 +92,11 @@ def test_pull(self):
|
|
with self.assertRaises(subprocess.CalledProcessError) as e:
|
|
run_command('pull', args=['--workers', '1'])
|
|
expected = get_expected_output('pull')
|
|
- self.assertEqual(e.exception.output, expected)
|
|
+ # replace message from older git versions
|
|
+ output = e.exception.output.replace(
|
|
+ b'anch. Please specify which\nbranch you want to merge with. See',
|
|
+ b'anch.\nPlease specify which branch you want to merge with.\nSee')
|
|
+ self.assertEqual(output, expected)
|
|
|
|
def test_pull_api(self):
|
|
try:
|
|
@@ -131,8 +135,12 @@ def test_pull_api(self):
|
|
os.chdir(cwd_bck)
|
|
|
|
assert rc == 1
|
|
+ # replace message from older git versions
|
|
+ output = stdout_stderr.getvalue().replace(
|
|
+ 'anch. Please specify which\nbranch you want to merge with. See',
|
|
+ 'anch.\nPlease specify which branch you want to merge with.\nSee')
|
|
expected = get_expected_output('pull').decode()
|
|
- assert stdout_stderr.getvalue() == expected
|
|
+ assert output == expected
|
|
|
|
def test_reimport(self):
|
|
cwd_vcstool = os.path.join(TEST_WORKSPACE, 'vcstool')
|
|
@@ -261,6 +269,20 @@ def run_command(command, args=None, subfolder=None):
|
|
[sys.executable, script] + (args or []),
|
|
stderr=subprocess.STDOUT, cwd=cwd, env=env)
|
|
# replace message from older git versions
|
|
+ output = output.replace(
|
|
+ b'git checkout -b new_branch_name',
|
|
+ b'git checkout -b <new-branch-name>')
|
|
+ output = output.replace(
|
|
+ b'(detached from ', b'(HEAD detached at ')
|
|
+ output = output.replace(
|
|
+ b"ady on 'master'\n=",
|
|
+ b"ady on 'master'\nYour branch is up-to-date with 'origin/master'.\n=")
|
|
+ output = output.replace(
|
|
+ b'# HEAD detached at ',
|
|
+ b'HEAD detached at ')
|
|
+ output = output.replace(
|
|
+ b'# On branch master',
|
|
+ b"On branch master\nYour branch is up-to-date with 'origin/master'.\n")
|
|
# the following seems to have changed between git 2.17.1 and 2.25.1
|
|
output = output.replace(
|
|
b"Note: checking out '", b"Note: switching to '")
|