OLD | NEW |
---|---|
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Generic presubmit checks that can be reused by other presubmit checks.""" | 5 """Generic presubmit checks that can be reused by other presubmit checks.""" |
6 | 6 |
7 | 7 |
8 ### Description checks | 8 ### Description checks |
9 | 9 |
10 def CheckChangeHasTestField(input_api, output_api): | 10 def CheckChangeHasTestField(input_api, output_api): |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
451 return [output_api.PresubmitError(short_text, long_text=long_text)] | 451 return [output_api.PresubmitError(short_text, long_text=long_text)] |
452 else: | 452 else: |
453 # TODO(bradnelson): drop this once all users are gone. | 453 # TODO(bradnelson): drop this once all users are gone. |
454 connection = input_api.urllib2.urlopen(url) | 454 connection = input_api.urllib2.urlopen(url) |
455 status = connection.read() | 455 status = connection.read() |
456 connection.close() | 456 connection.close() |
457 if input_api.re.match(closed, status): | 457 if input_api.re.match(closed, status): |
458 long_text = status + '\n' + url | 458 long_text = status + '\n' + url |
459 return [output_api.PresubmitError('The tree is closed.', | 459 return [output_api.PresubmitError('The tree is closed.', |
460 long_text=long_text)] | 460 long_text=long_text)] |
461 except IOError: | 461 except IOError as e: |
462 pass | 462 short_text = 'Error fetching tree status.' |
463 long_text = str(e) | |
464 return [output_api.PresubmitError(short_text, long_text=long_text)] | |
M-A Ruel
2012/01/30 20:50:15
I don't see much value in the 2 named variables. J
rohitrao (ping after 24h)
2012/01/30 20:58:54
Done.
| |
463 return [] | 465 return [] |
464 | 466 |
465 | 467 |
466 def RunUnitTestsInDirectory( | 468 def RunUnitTestsInDirectory( |
467 input_api, output_api, directory, whitelist=None, blacklist=None): | 469 input_api, output_api, directory, whitelist=None, blacklist=None): |
468 """Lists all files in a directory and runs them. Doesn't recurse. | 470 """Lists all files in a directory and runs them. Doesn't recurse. |
469 | 471 |
470 It's mainly a wrapper for RunUnitTests. USe whitelist and blacklist to filter | 472 It's mainly a wrapper for RunUnitTests. USe whitelist and blacklist to filter |
471 tests accordingly. | 473 tests accordingly. |
472 """ | 474 """ |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
913 results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( | 915 results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( |
914 input_api, output_api)) | 916 input_api, output_api)) |
915 snapshot("checking license") | 917 snapshot("checking license") |
916 results.extend(input_api.canned_checks.CheckLicense( | 918 results.extend(input_api.canned_checks.CheckLicense( |
917 input_api, output_api, license_header, source_file_filter=sources)) | 919 input_api, output_api, license_header, source_file_filter=sources)) |
918 snapshot("checking was uploaded") | 920 snapshot("checking was uploaded") |
919 results.extend(input_api.canned_checks.CheckChangeWasUploaded( | 921 results.extend(input_api.canned_checks.CheckChangeWasUploaded( |
920 input_api, output_api)) | 922 input_api, output_api)) |
921 snapshot("done") | 923 snapshot("done") |
922 return results | 924 return results |
OLD | NEW |