Index: PRESUBMIT.py |
diff --git a/PRESUBMIT.py b/PRESUBMIT.py |
index 2096425b550b6b8ab421411da09f5d4fac812c3c..c09f69ad694e265e92833679235026831918f824 100644 |
--- a/PRESUBMIT.py |
+++ b/PRESUBMIT.py |
@@ -8,50 +8,31 @@ See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for |
details on the presubmit API built into depot_tools. |
""" |
-UNIT_TESTS = [ |
- 'tests.fix_encoding_test', |
- 'tests.gcl_unittest', |
- 'tests.gclient_scm_test', |
- 'tests.gclient_smoketest', |
- 'tests.gclient_utils_test', |
- 'tests.owners_unittest', |
- 'tests.presubmit_unittest', |
- 'tests.scm_unittest', |
- 'tests.trychange_unittest', |
- 'tests.watchlists_unittest', |
-] |
- |
def CommonChecks(input_api, output_api): |
- output = [] |
- # Verify that LocalPath() is local, e.g.: |
- # os.path.join(PresubmitLocalPath(), LocalPath()) == AbsoluteLocalPath() |
- for i in input_api.AffectedFiles(): |
- if (input_api.os_path.join(input_api.PresubmitLocalPath(), i.LocalPath()) != |
- i.AbsoluteLocalPath()): |
- output.append(output_api.PresubmitError('Path inconsistency')) |
- # Return right away because it needs to be fixed first. |
- return output |
- |
- output.extend(input_api.canned_checks.CheckOwners(input_api, output_api)) |
- |
- output.extend(input_api.canned_checks.RunPythonUnitTests( |
- input_api, |
- output_api, |
- UNIT_TESTS)) |
+ results = [] |
- white_list = [r'.*\.py$', r'^git-try$'] |
+ results.extend(input_api.canned_checks.CheckOwners(input_api, output_api)) |
black_list = list(input_api.DEFAULT_BLACK_LIST) + [ |
r'^cpplint\.py$', |
- r'^tests[\/\\]\w+?[\/\\].+', |
- ] |
- output.extend(input_api.canned_checks.RunPylint( |
+ r'^tests[\/\\]\w+?[\/\\].+'] |
+ results.extend(input_api.canned_checks.RunPylint( |
input_api, |
output_api, |
- white_list=white_list, |
+ white_list=[r'.*\.py$', r'^git-try$'], |
black_list=black_list)) |
- output.extend(RunGitClTests(input_api, output_api)) |
- return output |
+ |
+ # TODO(maruel): Make sure at least one file is modified first. |
+ # TODO(maruel): If only tests are modified, only run them. |
+ verbose = False |
+ results.extend(input_api.canned_checks.RunUnitTestsInDirectory( |
+ input_api, |
+ output_api, |
+ 'tests', |
+ whitelist=[r'.*test\.py$'], |
+ verbose=verbose)) |
+ results.extend(RunGitClTests(input_api, output_api)) |
+ return results |
def RunGitClTests(input_api, output_api): |