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

Side by Side Diff: presubmit_canned_checks.py

Issue 9264044: Make the CheckTreeIsOpen presubmit check fail on IOError. (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools/
Patch Set: '' Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 return [output_api.PresubmitError('Error fetching tree status.',
463 long_text=str(e))]
463 return [] 464 return []
464 465
465 466
466 def RunUnitTestsInDirectory( 467 def RunUnitTestsInDirectory(
467 input_api, output_api, directory, whitelist=None, blacklist=None): 468 input_api, output_api, directory, whitelist=None, blacklist=None):
468 """Lists all files in a directory and runs them. Doesn't recurse. 469 """Lists all files in a directory and runs them. Doesn't recurse.
469 470
470 It's mainly a wrapper for RunUnitTests. USe whitelist and blacklist to filter 471 It's mainly a wrapper for RunUnitTests. USe whitelist and blacklist to filter
471 tests accordingly. 472 tests accordingly.
472 """ 473 """
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( 914 results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes(
914 input_api, output_api)) 915 input_api, output_api))
915 snapshot("checking license") 916 snapshot("checking license")
916 results.extend(input_api.canned_checks.CheckLicense( 917 results.extend(input_api.canned_checks.CheckLicense(
917 input_api, output_api, license_header, source_file_filter=sources)) 918 input_api, output_api, license_header, source_file_filter=sources))
918 snapshot("checking was uploaded") 919 snapshot("checking was uploaded")
919 results.extend(input_api.canned_checks.CheckChangeWasUploaded( 920 results.extend(input_api.canned_checks.CheckChangeWasUploaded(
920 input_api, output_api)) 921 input_api, output_api))
921 snapshot("done") 922 snapshot("done")
922 return results 923 return results
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698