mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Use ProvidedDiffChange if diff is empty string
A ProvidedDiffChange should be able to use an diff, even if it is empty. Bug: 372936485 Change-Id: If6bea0063e92c8942aed080e4c26b8d032b90faa Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5926311 Commit-Queue: Gavin Mak <gavinmak@google.com> Reviewed-by: Scott Lee <ddoman@chromium.org>
This commit is contained in:
@@ -123,10 +123,6 @@ class TestParseDiff(unittest.TestCase):
|
||||
self.assertCountEqual(content, diff)
|
||||
self.assertCountEqual(change_files, expected)
|
||||
|
||||
def test_diff_to_change_files_raises_on_empty_file(self):
|
||||
with self.assertRaises(presubmit_support.PresubmitFailure):
|
||||
self._test_diff_to_change_files(diff='', expected=[])
|
||||
|
||||
def test_diff_to_change_files_raises_on_empty_diff_header(self):
|
||||
diff = """
|
||||
diff --git a/foo b/foo
|
||||
|
||||
@@ -1097,15 +1097,6 @@ def CheckChangeOnCommit(input_api, output_api):
|
||||
end_commit=options.end_commit)
|
||||
scm.GIT.GetAllFiles.assert_called_once_with(options.root)
|
||||
|
||||
def testParseChange_EmptyDiffFile(self):
|
||||
gclient_utils.FileRead.return_value = ''
|
||||
options = mock.Mock(all_files=False,
|
||||
files=[],
|
||||
generate_diff=False,
|
||||
diff_file='foo.diff')
|
||||
with self.assertRaises(presubmit.PresubmitFailure):
|
||||
presubmit._parse_change(None, options)
|
||||
|
||||
@mock.patch('presubmit_support.ProvidedDiffChange', mock.Mock())
|
||||
def testParseChange_ProvidedDiffFile(self):
|
||||
diff = """
|
||||
|
||||
Reference in New Issue
Block a user