Commit 9dea2ac1 authored by tandrii@chromium.org's avatar tandrii@chromium.org

Remove manual check using Rietveld for dry run.

It's now passed using command line flags.

This depends on https://codereview.chromium.org/1931633002,
which actually uses this command line flag.

R=sergiyb@chromium.org,phajdan.jr@chromium.org
BUG=601128

Review-Url: https://codereview.chromium.org/1929653002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@300268 0039d316-1c4b-4281-b951-d872f2087c98
parent c39431ae
......@@ -859,10 +859,7 @@ def CheckOwners(input_api, output_api, source_file_filter=None):
return [output_api.PresubmitNotifyResult(
'--tbr was specified, skipping OWNERS check')]
if input_api.change.issue:
if (input_api.dry_run or
# TODO(tandrii): clean below once CQ && run_presubmit.py recipe specify
# dry_run property. http://crbug.com/605563.
_GetRietveldIssueProps(input_api, None).get('cq_dry_run', False)):
if input_api.dry_run:
return [output_api.PresubmitNotifyResult(
'This is a dry run, skipping OWNERS check')]
else:
......
......@@ -2563,7 +2563,7 @@ class CannedChecksUnittest(PresubmitTestsBase):
def AssertOwnersWorks(self, tbr=False, issue='1', approvers=None,
reviewers=None, is_committing=True, rietveld_response=None,
uncovered_files=None, expected_output='',
manually_specified_reviewers=None, cq_dry_run=False):
manually_specified_reviewers=None, dry_run=None):
if approvers is None:
# The set of people who lgtm'ed a change.
approvers = set()
......@@ -2589,9 +2589,10 @@ class CannedChecksUnittest(PresubmitTestsBase):
input_api.owners_db = fake_db
input_api.is_committing = is_committing
input_api.tbr = tbr
input_api.dry_run = dry_run
if not is_committing or (not tbr and issue):
if not cq_dry_run:
if not dry_run:
affected_file.LocalPath().AndReturn('foo/xyz.cc')
change.AffectedFiles(file_filter=None).AndReturn([affected_file])
if issue and not rietveld_response:
......@@ -2606,14 +2607,10 @@ class CannedChecksUnittest(PresubmitTestsBase):
if is_committing:
people = approvers
if issue:
input_api.rietveld.get_issue_properties(
issue=int(input_api.change.issue), messages=None).AndReturn(
rietveld_response)
else:
people = reviewers
if not cq_dry_run:
if not dry_run:
if issue:
input_api.rietveld.get_issue_properties(
issue=int(input_api.change.issue), messages=True).AndReturn(
......@@ -2637,11 +2634,10 @@ class CannedChecksUnittest(PresubmitTestsBase):
def testCannedCheckOwners_DryRun(self):
response = {
"owner_email": "john@example.com",
"cq_dry_run": True,
"reviewers": ["ben@example.com"],
}
self.AssertOwnersWorks(approvers=set(),
cq_dry_run=True,
dry_run=True,
rietveld_response=response,
reviewers=set(["ben@example.com"]),
expected_output='This is a dry run, skipping OWNERS check\n')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment