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

Side by Side Diff: tools/checkteamtags/PRESUBMIT.py

Issue 2601773004: Adding check for team and component tags in owners files. (Closed)
Patch Set: PTAL, added check against multiple components in one line. Created 3 years, 11 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 unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright (c) 2017 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Top-level presubmit script for checkteamtags
6
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
8 details on the presubmit API.
9 """
10
11 import subprocess
12
13
14 def CheckChangeOnUpload(input_api, output_api):
15 return _CommonChecks(input_api, output_api)
16
17
18 def CheckChangeOnCommit(input_api, output_api):
19 return _CommonChecks(input_api, output_api)
20
21
22 def _CommonChecks(input_api, output_api):
23 """Does all presubmit checks for chekteamtags."""
24 results = []
25 results.extend(_RunUnitTests(input_api, output_api))
26 results.extend(_RunPyLint(input_api, output_api))
27 return results
28
29 def _RunUnitTests(input_api, output_api):
30 """Runs unit tests for checkteamtags."""
31 repo_root = input_api.change.RepositoryRoot()
32 checkteamtags_dir = input_api.os_path.join(repo_root, 'tools',
33 'checkteamtags')
34 test_runner = input_api.os_path.join(checkteamtags_dir, 'run_tests')
35 return_code = subprocess.call(['python', test_runner])
36 if return_code:
37 message = 'Checkteamtags unit tests did not all pass.'
38 return [output_api.PresubmitError(message)]
39 return []
40
41
42 def _RunPyLint(input_api, output_api):
43 """Runs unit tests for checkteamtags."""
44 tests = input_api.canned_checks.GetPylint(
45 input_api, output_api)
46 return input_api.RunTests(tests)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698