| OLD | NEW |
| 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 """Smoke tests for gclient.py. | 6 """Smoke tests for gclient.py. |
| 7 | 7 |
| 8 Shell out 'gclient' and run basic conformance tests. | 8 Shell out 'gclient' and run basic conformance tests. |
| 9 | 9 |
| 10 This test assumes GClientSmokeBase.URL_BASE is valid. | 10 This test assumes GClientSmokeBase.URL_BASE is valid. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 return 'svn://random.server/svn/' | 163 return 'svn://random.server/svn/' |
| 164 | 164 |
| 165 @property | 165 @property |
| 166 def git_base(self): | 166 def git_base(self): |
| 167 return 'git://random.server/git/' | 167 return 'git://random.server/git/' |
| 168 | 168 |
| 169 def testHelp(self): | 169 def testHelp(self): |
| 170 """testHelp: make sure no new command was added.""" | 170 """testHelp: make sure no new command was added.""" |
| 171 result = self.gclient(['help']) | 171 result = self.gclient(['help']) |
| 172 # Roughly, not too short, not too long. | 172 # Roughly, not too short, not too long. |
| 173 self.assertTrue(1000 < len(result[0]) and len(result[0]) < 2000) | 173 self.assertTrue(1000 < len(result[0]) and len(result[0]) < 2100, |
| 174 'Too much written to stdout: %d bytes' % len(result[0])) |
| 174 self.assertEquals(0, len(result[1])) | 175 self.assertEquals(0, len(result[1])) |
| 175 self.assertEquals(0, result[2]) | 176 self.assertEquals(0, result[2]) |
| 176 | 177 |
| 177 def testUnknown(self): | 178 def testUnknown(self): |
| 178 result = self.gclient(['foo']) | 179 result = self.gclient(['foo']) |
| 179 # Roughly, not too short, not too long. | 180 # Roughly, not too short, not too long. |
| 180 self.assertTrue(1000 < len(result[0]) and len(result[0]) < 2000) | 181 self.assertTrue(1000 < len(result[0]) and len(result[0]) < 2100, |
| 182 'Too much written to stdout: %d bytes' % len(result[0])) |
| 181 self.assertEquals(0, len(result[1])) | 183 self.assertEquals(0, len(result[1])) |
| 182 self.assertEquals(0, result[2]) | 184 self.assertEquals(0, result[2]) |
| 183 | 185 |
| 184 def testNotConfigured(self): | 186 def testNotConfigured(self): |
| 185 res = ('', 'Error: client not configured; see \'gclient config\'\n', 1) | 187 res = ('', 'Error: client not configured; see \'gclient config\'\n', 1) |
| 186 self.check(res, self.gclient(['cleanup'])) | 188 self.check(res, self.gclient(['cleanup'])) |
| 187 self.check(res, self.gclient(['diff'])) | 189 self.check(res, self.gclient(['diff'])) |
| 188 self.check(res, self.gclient(['pack'])) | 190 self.check(res, self.gclient(['pack'])) |
| 189 self.check(res, self.gclient(['revert'])) | 191 self.check(res, self.gclient(['revert'])) |
| 190 self.check(res, self.gclient(['revinfo'])) | 192 self.check(res, self.gclient(['revinfo'])) |
| (...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1319 | 1321 |
| 1320 if '-c' in sys.argv: | 1322 if '-c' in sys.argv: |
| 1321 COVERAGE = True | 1323 COVERAGE = True |
| 1322 sys.argv.remove('-c') | 1324 sys.argv.remove('-c') |
| 1323 if os.path.exists('.coverage'): | 1325 if os.path.exists('.coverage'): |
| 1324 os.remove('.coverage') | 1326 os.remove('.coverage') |
| 1325 os.environ['COVERAGE_FILE'] = os.path.join( | 1327 os.environ['COVERAGE_FILE'] = os.path.join( |
| 1326 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | 1328 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), |
| 1327 '.coverage') | 1329 '.coverage') |
| 1328 unittest.main() | 1330 unittest.main() |
| OLD | NEW |