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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 test(['config', '--spec', '["blah blah"]'], '["blah blah"]') | 187 test(['config', '--spec', '["blah blah"]'], '["blah blah"]') |
188 | 188 |
189 os.remove(p) | 189 os.remove(p) |
190 results = self.gclient(['config', 'foo', 'faa', 'fuu']) | 190 results = self.gclient(['config', 'foo', 'faa', 'fuu']) |
191 err = ('Usage: gclient.py config [options] [url] [safesync url]\n\n' | 191 err = ('Usage: gclient.py config [options] [url] [safesync url]\n\n' |
192 'gclient.py: error: Inconsistent arguments. Use either --spec or one' | 192 'gclient.py: error: Inconsistent arguments. Use either --spec or one' |
193 ' or 2 args\n') | 193 ' or 2 args\n') |
194 self.check(('', err, 2), results) | 194 self.check(('', err, 2), results) |
195 self.assertFalse(os.path.exists(join(self.root_dir, '.gclient'))) | 195 self.assertFalse(os.path.exists(join(self.root_dir, '.gclient'))) |
196 | 196 |
| 197 def testSolutionNone(self): |
| 198 results = self.gclient(['config', '--spec', |
| 199 'solutions=[{"name": "./", "url": None}]']) |
| 200 self.check(('', '', 0), results) |
| 201 results = self.gclient(['sync']) |
| 202 self.check(('', '', 0), results) |
| 203 self.assertTree({}) |
| 204 results = self.gclient(['revinfo']) |
| 205 self.check(('./: None\n', '', 0), results) |
| 206 self.check(('', '', 0), self.gclient(['cleanup'])) |
| 207 self.check(('', '', 0), self.gclient(['diff'])) |
| 208 self.check(('', '', 0), self.gclient(['export', 'foo'])) |
| 209 self.assertTree({}) |
| 210 self.check(('', '', 0), self.gclient(['pack'])) |
| 211 self.check(('', '', 0), self.gclient(['revert'])) |
| 212 self.assertTree({}) |
| 213 self.check(('', '', 0), self.gclient(['runhooks'])) |
| 214 self.assertTree({}) |
| 215 self.check(('', '', 0), self.gclient(['status'])) |
| 216 |
197 | 217 |
198 class GClientSmokeSVN(GClientSmokeBase): | 218 class GClientSmokeSVN(GClientSmokeBase): |
199 def setUp(self): | 219 def setUp(self): |
200 GClientSmokeBase.setUp(self) | 220 GClientSmokeBase.setUp(self) |
201 self.FAKE_REPOS.setUpSVN() | 221 self.FAKE_REPOS.setUpSVN() |
202 | 222 |
203 def testSync(self): | 223 def testSync(self): |
204 # TODO(maruel): safesync. | 224 # TODO(maruel): safesync. |
205 self.gclient(['config', self.svn_base + 'trunk/src/']) | 225 self.gclient(['config', self.svn_base + 'trunk/src/']) |
206 # Test unversioned checkout. | 226 # Test unversioned checkout. |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 if __name__ == '__main__': | 749 if __name__ == '__main__': |
730 if '-c' in sys.argv: | 750 if '-c' in sys.argv: |
731 COVERAGE = True | 751 COVERAGE = True |
732 sys.argv.remove('-c') | 752 sys.argv.remove('-c') |
733 if os.path.exists('.coverage'): | 753 if os.path.exists('.coverage'): |
734 os.remove('.coverage') | 754 os.remove('.coverage') |
735 os.environ['COVERAGE_FILE'] = os.path.join( | 755 os.environ['COVERAGE_FILE'] = os.path.join( |
736 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | 756 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), |
737 '.coverage') | 757 '.coverage') |
738 unittest.main() | 758 unittest.main() |
OLD | NEW |