| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 self.check(res, self.gclient(['diff'])) | 138 self.check(res, self.gclient(['diff'])) |
| 139 self.check(res, self.gclient(['export', 'foo'])) | 139 self.check(res, self.gclient(['export', 'foo'])) |
| 140 self.check(res, self.gclient(['pack'])) | 140 self.check(res, self.gclient(['pack'])) |
| 141 self.check(res, self.gclient(['revert'])) | 141 self.check(res, self.gclient(['revert'])) |
| 142 self.check(res, self.gclient(['revinfo'])) | 142 self.check(res, self.gclient(['revinfo'])) |
| 143 self.check(res, self.gclient(['runhooks'])) | 143 self.check(res, self.gclient(['runhooks'])) |
| 144 self.check(res, self.gclient(['status'])) | 144 self.check(res, self.gclient(['status'])) |
| 145 self.check(res, self.gclient(['sync'])) | 145 self.check(res, self.gclient(['sync'])) |
| 146 self.check(res, self.gclient(['update'])) | 146 self.check(res, self.gclient(['update'])) |
| 147 | 147 |
| 148 def testWrongConfig(self): | |
| 149 # tested in testConfig. | |
| 150 self.gclient(['config', self.svn_base + 'trunk/src/']) | |
| 151 other_src = join(self.root_dir, 'src-other') | |
| 152 os.mkdir(other_src) | |
| 153 res = ('', 'Error: client not configured; see \'gclient config\'\n', 1) | |
| 154 self.check(res, self.gclient(['status'], other_src)) | |
| 155 | |
| 156 def testConfig(self): | 148 def testConfig(self): |
| 157 p = join(self.root_dir, '.gclient') | 149 p = join(self.root_dir, '.gclient') |
| 158 def test(cmd, expected): | 150 def test(cmd, expected): |
| 159 if os.path.exists(p): | 151 if os.path.exists(p): |
| 160 os.remove(p) | 152 os.remove(p) |
| 161 results = self.gclient(cmd) | 153 results = self.gclient(cmd) |
| 162 self.check(('', '', 0), results) | 154 self.check(('', '', 0), results) |
| 163 self.checkString(expected, open(p, 'rU').read()) | 155 self.checkString(expected, open(p, 'rU').read()) |
| 164 | 156 |
| 165 test(['config', self.svn_base + 'trunk/src/'], | 157 test(['config', self.svn_base + 'trunk/src/'], |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 if __name__ == '__main__': | 879 if __name__ == '__main__': |
| 888 if '-c' in sys.argv: | 880 if '-c' in sys.argv: |
| 889 COVERAGE = True | 881 COVERAGE = True |
| 890 sys.argv.remove('-c') | 882 sys.argv.remove('-c') |
| 891 if os.path.exists('.coverage'): | 883 if os.path.exists('.coverage'): |
| 892 os.remove('.coverage') | 884 os.remove('.coverage') |
| 893 os.environ['COVERAGE_FILE'] = os.path.join( | 885 os.environ['COVERAGE_FILE'] = os.path.join( |
| 894 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | 886 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), |
| 895 '.coverage') | 887 '.coverage') |
| 896 unittest.main() | 888 unittest.main() |
| OLD | NEW |