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 """Top-level presubmit script for chromium-build. | 5 """Top-level presubmit script for chromium-build. |
6 | 6 |
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for |
8 details on the presubmit API built into gcl. | 8 details on the presubmit API built into gcl. |
9 | 9 |
10 Setup instructions: | 10 Setup instructions: |
11 sudo easy_install nose nosegae WebTest | 11 sudo easy_install nose nosegae WebTest |
12 sudo aptitude install python-mysqldb # Resolves the 'The rdbms API is not | 12 sudo aptitude install python-mysqldb # Resolves the 'The rdbms API is not |
13 # available' warning. | 13 # available' warning. |
14 download GAE SDK to ../google_appengine/ | 14 download GAE SDK to ../google_appengine/ |
15 git cl presubmit | 15 git cl presubmit |
16 | 16 |
17 To run the tests directly: | 17 To run the tests directly: |
18 export PYTHONPATH="../google_appengine/" | 18 export PYTHONPATH="../google_appengine/" |
19 nosetests --with-gae --gae-lib-root=../ | 19 nosetests --with-gae --gae-lib-root=../google_appengine/ |
20 | 20 |
21 To interact with the environment: | 21 To interact with the environment: |
22 (insert a line: import code; code.interact(locals=local())) | 22 (insert a line: import code; code.interact(locals=local())) |
23 export PYTHONPATH="../google_appengine/" | 23 export PYTHONPATH="../google_appengine/" |
24 nosetests --with-gae --gae-lib-root=../ -s | 24 nosetests --with-gae --gae-lib-root=../google_appengine/ -s |
25 """ | 25 """ |
26 | 26 |
27 | 27 |
28 import sys | 28 import sys |
29 | 29 |
30 | 30 |
31 def CommonChecks(input_api, output_api): | 31 def CommonChecks(input_api, output_api): |
32 # We don't want to hinder users from uploading incomplete patches. | 32 # We don't want to hinder users from uploading incomplete patches. |
33 if input_api.is_committing: | 33 if input_api.is_committing: |
34 message_type = output_api.PresubmitError | 34 message_type = output_api.PresubmitError |
(...skipping 30 matching lines...) Expand all Loading... | |
65 | 65 |
66 # Run PyLint checks. | 66 # Run PyLint checks. |
67 backup_sys_path = sys.path | 67 backup_sys_path = sys.path |
68 try: | 68 try: |
69 black_list = list(input_api.DEFAULT_BLACK_LIST) | 69 black_list = list(input_api.DEFAULT_BLACK_LIST) |
70 sys.path = [ | 70 sys.path = [ |
71 sdk_path, | 71 sdk_path, |
72 input_api.os_path.join(sdk_path, 'lib'), | 72 input_api.os_path.join(sdk_path, 'lib'), |
73 input_api.os_path.join(sdk_path, 'lib', 'simplejson'), | 73 input_api.os_path.join(sdk_path, 'lib', 'simplejson'), |
74 ] + sys.path | 74 ] + sys.path |
75 # Update our environment to include the standard modules in AppEngine. | |
76 import appcfg | |
77 appcfg.fix_sys_path() | |
78 disabled_warnings = [ | |
79 'E1101', # has no member, disabled due to webapp2 and AppEngine SDK | |
M-A Ruel
2012/05/29 20:03:49
An option would be to add 'webapp2.RequestHandler'
cmp
2012/05/29 20:20:28
Done.
| |
80 'W0232', # has no init, disabled due to webapp2 | |
81 ] | |
75 results.extend(input_api.canned_checks.RunPylint( | 82 results.extend(input_api.canned_checks.RunPylint( |
76 input_api, | 83 input_api, |
77 output_api, | 84 output_api, |
78 black_list=black_list)) | 85 black_list=black_list, |
86 disabled_warnings=disabled_warnings)) | |
79 finally: | 87 finally: |
80 sys.path = backup_sys_path | 88 sys.path = backup_sys_path |
81 return results | 89 return results |
82 | 90 |
83 | 91 |
84 def CheckChangeOnUpload(input_api, output_api): | 92 def CheckChangeOnUpload(input_api, output_api): |
85 return CommonChecks(input_api, output_api) | 93 return CommonChecks(input_api, output_api) |
86 | 94 |
87 | 95 |
88 def CheckChangeOnCommit(input_api, output_api): | 96 def CheckChangeOnCommit(input_api, output_api): |
89 return CommonChecks(input_api, output_api) | 97 return CommonChecks(input_api, output_api) |
OLD | NEW |