mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Fix argument mismatch in split_cl.py
When adding tests, the LoadDescription function accidentally got called with the wrong arguments in the main function. This fixes that; a future CL (uploading shortly) adds more robust tests that would have caught this. Bug: 389568463, 389069356 Change-Id: Icaf5e83cd8caa9f3975173f8c8ee7d92ef44ee56 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6170638 Commit-Queue: Andy Perelson <ajp@google.com> Reviewed-by: Brian Ryner <bryner@google.com> Reviewed-by: Andy Perelson <ajp@google.com> Auto-Submit: Devon Loehr <dloehr@google.com>
This commit is contained in:
@@ -196,11 +196,21 @@ class SplitClTest(unittest.TestCase):
|
||||
@mock.patch("gclient_utils.FileRead", return_value="Description")
|
||||
def testLoadDescription(self, mock_file_read):
|
||||
# No description provided, use the dummy:
|
||||
self.assertTrue(split_cl.LoadDescription(None).startswith("Dummy"))
|
||||
self.assertTrue(
|
||||
split_cl.LoadDescription(None, True).startswith("Dummy"))
|
||||
self.assertEqual(mock_file_read.call_count, 0)
|
||||
|
||||
# Description file provided, load it
|
||||
self.assertEqual(split_cl.LoadDescription("SomeFile.txt"),
|
||||
# No description provided during a real run
|
||||
self.assertRaises(ValueError, split_cl.LoadDescription, None, False)
|
||||
self.assertEqual(mock_file_read.call_count, 0)
|
||||
|
||||
# Description file provided, load it regardless of dry run
|
||||
self.assertEqual(split_cl.LoadDescription("SomeFile.txt", False),
|
||||
"Description")
|
||||
self.assertEqual(mock_file_read.call_count, 1)
|
||||
|
||||
mock_file_read.reset_mock()
|
||||
self.assertEqual(split_cl.LoadDescription("SomeFile.txt", True),
|
||||
"Description")
|
||||
self.assertEqual(mock_file_read.call_count, 1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user