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

Side by Side Diff: testing_support/local_rietveld.py

Issue 13867008: Fix presubmit check with newer version of AppEngine SDK v1.7.6. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 7 years, 8 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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Setups a local Rietveld instance to test against a live server for 6 """Setups a local Rietveld instance to test against a live server for
7 integration tests. 7 integration tests.
8 8
9 It makes sure Google AppEngine SDK is found, download Rietveld and Django code 9 It makes sure Google AppEngine SDK is found, download Rietveld and Django code
10 if necessary and starts the server on a free inbound TCP port. 10 if necessary and starts the server on a free inbound TCP port.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 while not test_port(self.port): 132 while not test_port(self.port):
133 self.test_server.poll() 133 self.test_server.poll()
134 if self.test_server.returncode is not None: 134 if self.test_server.returncode is not None:
135 raise Failure( 135 raise Failure(
136 'Test rietveld instance failed early on port %s' % 136 'Test rietveld instance failed early on port %s' %
137 self.port) 137 self.port)
138 time.sleep(0.01) 138 time.sleep(0.01)
139 139
140 def stop_server(self): 140 def stop_server(self):
141 if self.test_server: 141 if self.test_server:
142 self.test_server.kill() 142 try:
143 self.test_server.kill()
144 except OSError:
145 pass
143 self.test_server.wait() 146 self.test_server.wait()
144 self.test_server = None 147 self.test_server = None
145 self.port = None 148 self.port = None
146 149
147 150
148 def main(): 151 def main():
149 parser = optparse.OptionParser() 152 parser = optparse.OptionParser()
150 parser.add_option('-v', '--verbose', action='store_true') 153 parser.add_option('-v', '--verbose', action='store_true')
151 options, args = parser.parse_args() 154 options, args = parser.parse_args()
152 if args: 155 if args:
153 parser.error('Unknown arguments: %s' % ' '.join(args)) 156 parser.error('Unknown arguments: %s' % ' '.join(args))
154 instance = LocalRietveld() 157 instance = LocalRietveld()
155 try: 158 try:
156 instance.start_server(verbose=options.verbose) 159 instance.start_server(verbose=options.verbose)
157 print 'Local rietveld instance started on port %d' % instance.port 160 print 'Local rietveld instance started on port %d' % instance.port
158 while True: 161 while True:
159 time.sleep(0.1) 162 time.sleep(0.1)
160 finally: 163 finally:
161 instance.stop_server() 164 instance.stop_server()
162 165
163 166
164 if __name__ == '__main__': 167 if __name__ == '__main__':
165 main() 168 main()
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