| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 if len(out[i]) < 2: | 112 if len(out[i]) < 2: |
| 113 continue | 113 continue |
| 114 out[i] = [out[i][0]] + sorted([x[1:].strip() for x in out[i][1:]]) | 114 out[i] = [out[i][0]] + sorted([x[1:].strip() for x in out[i][1:]]) |
| 115 return out | 115 return out |
| 116 | 116 |
| 117 | 117 |
| 118 class GClientSmoke(GClientSmokeBase): | 118 class GClientSmoke(GClientSmokeBase): |
| 119 def testHelp(self): | 119 def testHelp(self): |
| 120 """testHelp: make sure no new command was added.""" | 120 """testHelp: make sure no new command was added.""" |
| 121 result = self.gclient(['help']) | 121 result = self.gclient(['help']) |
| 122 self.assertEquals(1197, len(result[0])) | 122 # Roughly, not too short, not too long. |
| 123 self.assertTrue(1000 < len(result[0]) and len(result[0]) < 2000) |
| 123 self.assertEquals(0, len(result[1])) | 124 self.assertEquals(0, len(result[1])) |
| 124 self.assertEquals(0, result[2]) | 125 self.assertEquals(0, result[2]) |
| 125 | 126 |
| 126 def testUnknown(self): | 127 def testUnknown(self): |
| 127 result = self.gclient(['foo']) | 128 result = self.gclient(['foo']) |
| 128 self.assertEquals(1197, len(result[0])) | 129 # Roughly, not too short, not too long. |
| 130 self.assertTrue(1000 < len(result[0]) and len(result[0]) < 2000) |
| 129 self.assertEquals(0, len(result[1])) | 131 self.assertEquals(0, len(result[1])) |
| 130 self.assertEquals(0, result[2]) | 132 self.assertEquals(0, result[2]) |
| 131 | 133 |
| 132 def testNotConfigured(self): | 134 def testNotConfigured(self): |
| 133 res = ('', 'Error: client not configured; see \'gclient config\'\n', 1) | 135 res = ('', 'Error: client not configured; see \'gclient config\'\n', 1) |
| 134 self.check(res, self.gclient(['cleanup'])) | 136 self.check(res, self.gclient(['cleanup'])) |
| 135 self.check(res, self.gclient(['diff'])) | 137 self.check(res, self.gclient(['diff'])) |
| 136 self.check(res, self.gclient(['export', 'foo'])) | 138 self.check(res, self.gclient(['export', 'foo'])) |
| 137 self.check(res, self.gclient(['pack'])) | 139 self.check(res, self.gclient(['pack'])) |
| 138 self.check(res, self.gclient(['revert'])) | 140 self.check(res, self.gclient(['revert'])) |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 if __name__ == '__main__': | 637 if __name__ == '__main__': |
| 636 if '-c' in sys.argv: | 638 if '-c' in sys.argv: |
| 637 COVERAGE = True | 639 COVERAGE = True |
| 638 sys.argv.remove('-c') | 640 sys.argv.remove('-c') |
| 639 if os.path.exists('.coverage'): | 641 if os.path.exists('.coverage'): |
| 640 os.remove('.coverage') | 642 os.remove('.coverage') |
| 641 os.environ['COVERAGE_FILE'] = os.path.join( | 643 os.environ['COVERAGE_FILE'] = os.path.join( |
| 642 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | 644 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), |
| 643 '.coverage') | 645 '.coverage') |
| 644 unittest.main() | 646 unittest.main() |
| OLD | NEW |