Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 | 48 |
| 49 def __init__(self, base_dir=None): | 49 def __init__(self, base_dir=None): |
| 50 # Paths | 50 # Paths |
| 51 self.base_dir = base_dir | 51 self.base_dir = base_dir |
| 52 if not self.base_dir: | 52 if not self.base_dir: |
| 53 self.base_dir = os.path.dirname(os.path.abspath(__file__)) | 53 self.base_dir = os.path.dirname(os.path.abspath(__file__)) |
| 54 self.base_dir = os.path.realpath(os.path.join(self.base_dir, '..')) | 54 self.base_dir = os.path.realpath(os.path.join(self.base_dir, '..')) |
| 55 self.sdk_path = os.path.abspath( | 55 self.sdk_path = os.path.abspath( |
| 56 os.path.join(self.base_dir, '..', 'google_appengine')) | 56 os.path.join(self.base_dir, '..', 'google_appengine')) |
| 57 self.dev_app = os.path.join(self.sdk_path, 'dev_appserver.py') | 57 self.dev_app = os.path.join(self.sdk_path, 'dev_appserver.py') |
| 58 self.rietveld = os.path.join(self.base_dir, 'tests', 'rietveld') | 58 self.rietveld = os.path.join(self.base_dir, 'tests', '_rietveld') |
|
M-A Ruel
2011/04/04 19:08:34
Otherwise pylint would think rietveld_test.py woul
| |
| 59 self.test_server = None | 59 self.test_server = None |
| 60 self.port = None | 60 self.port = None |
| 61 | 61 |
| 62 def install_prerequisites(self): | 62 def install_prerequisites(self): |
| 63 # First, verify the Google AppEngine SDK is available. | 63 # First, verify the Google AppEngine SDK is available. |
| 64 if not os.path.isfile(self.dev_app): | 64 if not os.path.isfile(self.dev_app): |
| 65 raise Failure('Install google_appengine sdk in %s' % self.sdk_path) | 65 raise Failure('Install google_appengine sdk in %s' % self.sdk_path) |
| 66 | 66 |
| 67 # Second, checkout rietveld if not available. | 67 # Second, checkout rietveld if not available. |
| 68 if not os.path.isdir(self.rietveld): | 68 if not os.path.isdir(self.rietveld): |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 instance.start_server(verbose=options.verbose) | 125 instance.start_server(verbose=options.verbose) |
| 126 print 'Local rietveld instance started on port %d' % instance.port | 126 print 'Local rietveld instance started on port %d' % instance.port |
| 127 while True: | 127 while True: |
| 128 time.sleep(0.1) | 128 time.sleep(0.1) |
| 129 finally: | 129 finally: |
| 130 instance.stop_server() | 130 instance.stop_server() |
| 131 | 131 |
| 132 | 132 |
| 133 if __name__ == '__main__': | 133 if __name__ == '__main__': |
| 134 main() | 134 main() |
| OLD | NEW |