Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(813)

Unified Diff: tests/git_cl_test.py

Issue 1760063002: git cl: stop downloading Gerrit commit-hook with --squash mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@G0850
Patch Set: fix tests, for real this time. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « git_cl.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/git_cl_test.py
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index e4a412b79130df78a95dff617f7626b0107a73a6..6f0eea4af071d1e9e42c401571ce40205df31874 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -582,7 +582,10 @@ class TestGitCl(TestCase):
@classmethod
def _gerrit_upload_calls(cls, description, reviewers, squash,
- expected_upstream_ref='origin/refs/heads/master'):
+ expected_upstream_ref='origin/refs/heads/master',
+ post_amend_description=None):
+ if post_amend_description is None:
+ post_amend_description = description
calls = [
((['git', 'config', '--bool', 'gerrit.squash-uploads'],), 'false'),
((['git', 'log', '--pretty=format:%s\n\n%b',
@@ -590,7 +593,12 @@ class TestGitCl(TestCase):
description)
]
if not git_footers.get_footer_change_id(description) and not squash:
+ # TODOOOOO
calls += [
+ # DownloadGerritHook(False)
+ ((False, ),
+ ''),
+ # Amending of commit message to get the Change-Id.
((['git', 'log', '--pretty=format:%s\n\n%b',
'fake_ancestor_sha..HEAD'],),
description),
@@ -598,7 +606,7 @@ class TestGitCl(TestCase):
''),
((['git', 'log', '--pretty=format:%s\n\n%b',
'fake_ancestor_sha..HEAD'],),
- description)
+ post_amend_description)
]
if squash:
ref_to_push = 'abcdef0123456789'
@@ -655,21 +663,25 @@ class TestGitCl(TestCase):
description,
reviewers,
squash=False,
- expected_upstream_ref='origin/refs/heads/master'):
+ expected_upstream_ref='origin/refs/heads/master',
+ post_amend_description=None):
"""Generic gerrit upload test framework."""
self.calls = self._gerrit_base_calls()
self.calls += self._gerrit_upload_calls(
description, reviewers, squash,
- expected_upstream_ref=expected_upstream_ref)
+ expected_upstream_ref=expected_upstream_ref,
+ post_amend_description=post_amend_description)
# Uncomment when debugging.
# print '\n'.join(map(lambda x: '%2i: %s' % x, enumerate(self.calls)))
git_cl.main(['upload'] + upload_args)
def test_gerrit_upload_without_change_id(self):
+ self.mock(git_cl, 'DownloadGerritHook', self._mocked_call)
self._run_gerrit_upload_test(
[],
'desc\n\nBUG=\n',
- [])
+ [],
+ post_amend_description='desc\n\nBUG=\n\nChange-Id: Ixxx')
def test_gerrit_no_reviewer(self):
self._run_gerrit_upload_test(
@@ -818,14 +830,6 @@ class TestGitCl(TestCase):
((['git', 'config', '--unset-all',
'rietveld.run-post-upload-hook'],), ''),
((['git', 'config', 'gerrit.host', 'True'],), ''),
- # DownloadHooks(False)
- ((['git', 'config', 'gerrit.host'],), 'True'),
- ((['git', 'rev-parse', '--show-cdup'],), ''),
- ((commit_msg_path, os.X_OK,), False),
- (('https://gerrit-review.googlesource.com/tools/hooks/commit-msg',
- commit_msg_path,), ''),
- ((commit_msg_path,), True),
- ((commit_msg_path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR,), ''),
# GetCodereviewSettingsInteractively
((['git', 'config', 'rietveld.server'],),
'gerrit.chromium.org'),
@@ -839,12 +843,18 @@ class TestGitCl(TestCase):
(('Tree status URL:',), ''),
((['git', 'config', 'rietveld.viewvc-url'],), ''),
(('ViewVC URL:',), ''),
- # DownloadHooks(True)
((['git', 'config', 'rietveld.bug-prefix'],), ''),
(('Bug Prefix:',), ''),
((['git', 'config', 'rietveld.run-post-upload-hook'],), ''),
(('Run Post Upload Hook:',), ''),
- ((commit_msg_path, os.X_OK,), True),
+ # DownloadGerritHook(False)
+ ((['git', 'config', 'gerrit.host'],), 'True'),
+ ((['git', 'rev-parse', '--show-cdup'],), ''),
+ ((commit_msg_path, os.X_OK,), False),
+ (('https://gerrit-review.googlesource.com/tools/hooks/commit-msg',
+ commit_msg_path,), ''),
+ ((commit_msg_path,), True),
+ ((commit_msg_path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR,), ''),
]
git_cl.main(['config'])
« no previous file with comments | « git_cl.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698