tests: switch to 4 space indent

Reformat this dir by itself to help merging with conflicts with other CLs.

Reformatted using:
parallel ./yapf -i -- tests/*.py
~/chromiumos/chromite/contrib/reflow_overlong_comments tests/*.py

These files still had lines (strings) that were too long, so the pylint
warnings were suppressed with a TODO.
tests/bot_update_coverage_test.py
tests/cipd_bootstrap_test.py
tests/gclient_eval_unittest.py
tests/gclient_git_smoketest.py
tests/gclient_scm_test.py
tests/gclient_smoketest.py
tests/gclient_test.py
tests/gclient_transitions_smoketest.py
tests/gclient_utils_test.py
tests/git_cl_test.py
tests/git_hyper_blame_test.py
tests/git_rebase_update_test.py
tests/lockfile_test.py
tests/metrics_test.py
tests/presubmit_canned_checks_test.py
tests/presubmit_unittest.py
tests/roll_dep_test.py

Change-Id: I8fed04b4ba81d54b8f45da612213aad27a9e1a2c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4842592
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Mike Frysinger
2023-09-05 20:24:16 +00:00
committed by LUCI CQ
parent f38dc929a8
commit 677616322a
56 changed files with 22777 additions and 21874 deletions

View File

@@ -18,39 +18,40 @@ import git_find_releases
class TestGitFindReleases(unittest.TestCase):
@mock.patch('sys.stdout', StringIO())
@mock.patch('git_common.run', return_value='')
def test_invalid_commit(self, git_run):
result = git_find_releases.main(['foo'])
self.assertEqual(1, result)
self.assertEqual('foo not found', sys.stdout.getvalue().strip())
git_run.assert_called_once_with('name-rev', '--tags', '--name-only', 'foo')
@mock.patch('sys.stdout', StringIO())
@mock.patch('git_common.run', return_value='')
def test_invalid_commit(self, git_run):
result = git_find_releases.main(['foo'])
self.assertEqual(1, result)
self.assertEqual('foo not found', sys.stdout.getvalue().strip())
git_run.assert_called_once_with('name-rev', '--tags', '--name-only',
'foo')
@mock.patch('sys.stdout', StringIO())
@mock.patch('git_common.run')
def test_no_merge(self, git_run):
def git_run_function(*args):
assert len(args) > 1
if args[0] == 'name-rev' and args[1] == '--tags':
return 'undefined'
@mock.patch('sys.stdout', StringIO())
@mock.patch('git_common.run')
def test_no_merge(self, git_run):
def git_run_function(*args):
assert len(args) > 1
if args[0] == 'name-rev' and args[1] == '--tags':
return 'undefined'
if args[0] == 'name-rev' and args[1] == '--refs':
return '1.0.0'
if args[0] == 'name-rev' and args[1] == '--refs':
return '1.0.0'
if args[0] == 'log':
return ''
assert False, "Unexpected arguments for git.run"
if args[0] == 'log':
return ''
assert False, "Unexpected arguments for git.run"
git_run.side_effect = git_run_function
result = git_find_releases.main(['foo'])
self.assertEqual(0, result)
stdout = sys.stdout.getvalue().strip()
self.assertIn('commit foo was', stdout)
self.assertIn('No merges found', stdout)
self.assertEqual(3, git_run.call_count)
git_run.side_effect = git_run_function
result = git_find_releases.main(['foo'])
self.assertEqual(0, result)
stdout = sys.stdout.getvalue().strip()
self.assertIn('commit foo was', stdout)
self.assertIn('No merges found', stdout)
self.assertEqual(3, git_run.call_count)
if __name__ == '__main__':
logging.basicConfig(
level=logging.DEBUG if '-v' in sys.argv else logging.ERROR)
unittest.main()
logging.basicConfig(
level=logging.DEBUG if '-v' in sys.argv else logging.ERROR)
unittest.main()