From 9dea2ac16f91ac30b574fb0e608618198dc74d4e Mon Sep 17 00:00:00 2001 From: "tandrii@chromium.org" Date: Thu, 28 Apr 2016 06:26:20 +0000 Subject: [PATCH] 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 --- presubmit_canned_checks.py | 5 +---- tests/presubmit_unittest.py | 14 +++++--------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py index e63b798a3..e21d08675 100644 --- a/presubmit_canned_checks.py +++ b/presubmit_canned_checks.py @@ -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: diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py index ed57ffa05..d0c9c10ed 100755 --- a/tests/presubmit_unittest.py +++ b/tests/presubmit_unittest.py @@ -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')