Compatibility with ydiff==1.4.2 (#3216)

1. Implemented compatibility.
2. Constrained the upper version in requirements.txt to avoid future failures.
3. Setup an additional pipeline to check with the latest ydiff.

Close #3209
Close #3212
Close #3218
This commit is contained in:
Alexander Kukushkin
2024-11-19 09:27:49 +01:00
committed by GitHub
parent 19f75b407e
commit a903438a5a
6 changed files with 34 additions and 5 deletions
+11
View File
@@ -689,6 +689,17 @@ class TestCtl(unittest.TestCase):
show_diff(b"foo:\n bar: \xc3\xb6\xc3\xb6\n".decode('utf-8'),
b"foo:\n bar: \xc3\xbc\xc3\xbc\n".decode('utf-8'))
@patch('subprocess.Popen')
@patch('os.environ.get', Mock(return_value='cat'))
@patch('sys.stdout.isatty', Mock(return_value=True))
@patch('shutil.which', Mock(return_value='cat'))
def test_show_diff_pager(self, mock_popen):
show_diff("foo:\n bar: 1\n", "foo:\n bar: 2\n")
self.assertEqual(mock_popen.return_value.stdin.write.call_count, 6)
self.assertIn(b' bar: ', mock_popen.return_value.stdin.write.call_args_list[5][0][0])
self.assertIn(b' bar: ', mock_popen.return_value.stdin.write.call_args_list[4][0][0])
self.assertIn(b' foo:', mock_popen.return_value.stdin.write.call_args_list[3][0][0])
@patch('subprocess.call', return_value=1)
def test_invoke_editor(self, mock_subprocess_call):
os.environ.pop('EDITOR', None)