| 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 """Unit tests for gclient_scm.py.""" | 6 """Unit tests for gclient_scm.py.""" |
| 7 | 7 |
| 8 # pylint: disable=E1103 | 8 # pylint: disable=E1103 |
| 9 | 9 |
| 10 # Import before super_mox to keep valid references. | 10 # Import before super_mox to keep valid references. |
| (...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') | 1298 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') |
| 1299 ).AndReturn(False) | 1299 ).AndReturn(False) |
| 1300 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) | 1300 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) |
| 1301 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') | 1301 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') |
| 1302 ).AndReturn(False) | 1302 ).AndReturn(False) |
| 1303 | 1303 |
| 1304 self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True) | 1304 self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True) |
| 1305 # pylint: disable=E1120 | 1305 # pylint: disable=E1120 |
| 1306 gclient_scm.GitWrapper._Clone('refs/remotes/origin/master', self.url, | 1306 gclient_scm.GitWrapper._Clone('refs/remotes/origin/master', self.url, |
| 1307 options) | 1307 options) |
| 1308 # pylint: disable=E1120 | |
| 1309 self.mox.StubOutWithMock(gclient_scm.GitWrapper, 'UpdateSubmoduleConfig', | |
| 1310 True) | |
| 1311 gclient_scm.GitWrapper.UpdateSubmoduleConfig() | |
| 1312 self.mox.StubOutWithMock(gclient_scm.subprocess2, 'check_output', True) | 1308 self.mox.StubOutWithMock(gclient_scm.subprocess2, 'check_output', True) |
| 1313 gclient_scm.subprocess2.check_output(['git', 'ls-files'], | 1309 gclient_scm.subprocess2.check_output(['git', 'ls-files'], |
| 1314 cwd=self.base_path, | 1310 cwd=self.base_path, |
| 1315 stderr=-1, | 1311 stderr=-1, |
| 1316 ).AndReturn('') | 1312 ).AndReturn('') |
| 1317 gclient_scm.subprocess2.check_output( | 1313 gclient_scm.subprocess2.check_output( |
| 1318 ['git', 'rev-parse', '--verify', 'HEAD'], | 1314 ['git', 'rev-parse', '--verify', 'HEAD'], |
| 1319 cwd=self.base_path, | 1315 cwd=self.base_path, |
| 1320 stderr=-1, | 1316 stderr=-1, |
| 1321 ).AndReturn('') | 1317 ).AndReturn('') |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1334 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') | 1330 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') |
| 1335 ).AndReturn(False) | 1331 ).AndReturn(False) |
| 1336 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) | 1332 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) |
| 1337 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') | 1333 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') |
| 1338 ).AndReturn(False) | 1334 ).AndReturn(False) |
| 1339 self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True) | 1335 self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True) |
| 1340 # pylint: disable=E1120 | 1336 # pylint: disable=E1120 |
| 1341 gclient_scm.GitWrapper._Clone('refs/remotes/origin/master', self.url, | 1337 gclient_scm.GitWrapper._Clone('refs/remotes/origin/master', self.url, |
| 1342 options) | 1338 options) |
| 1343 # pylint: disable=E1120 | 1339 # pylint: disable=E1120 |
| 1344 self.mox.StubOutWithMock(gclient_scm.GitWrapper, 'UpdateSubmoduleConfig', | |
| 1345 True) | |
| 1346 gclient_scm.GitWrapper.UpdateSubmoduleConfig() | |
| 1347 self.mox.StubOutWithMock(gclient_scm.subprocess2, 'check_output', True) | 1340 self.mox.StubOutWithMock(gclient_scm.subprocess2, 'check_output', True) |
| 1348 gclient_scm.subprocess2.check_output(['git', 'ls-files'], | 1341 gclient_scm.subprocess2.check_output(['git', 'ls-files'], |
| 1349 cwd=self.base_path, | 1342 cwd=self.base_path, |
| 1350 stderr=-1, | 1343 stderr=-1, |
| 1351 ).AndReturn('') | 1344 ).AndReturn('') |
| 1352 gclient_scm.subprocess2.check_output( | 1345 gclient_scm.subprocess2.check_output( |
| 1353 ['git', 'rev-parse', '--verify', 'HEAD'], | 1346 ['git', 'rev-parse', '--verify', 'HEAD'], |
| 1354 cwd=self.base_path, | 1347 cwd=self.base_path, |
| 1355 stderr=-1, | 1348 stderr=-1, |
| 1356 ).AndReturn('') | 1349 ).AndReturn('') |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1381 | 1374 |
| 1382 if __name__ == '__main__': | 1375 if __name__ == '__main__': |
| 1383 if '-v' in sys.argv: | 1376 if '-v' in sys.argv: |
| 1384 logging.basicConfig( | 1377 logging.basicConfig( |
| 1385 level=logging.DEBUG, | 1378 level=logging.DEBUG, |
| 1386 format='%(asctime).19s %(levelname)s %(filename)s:' | 1379 format='%(asctime).19s %(levelname)s %(filename)s:' |
| 1387 '%(lineno)s %(message)s') | 1380 '%(lineno)s %(message)s') |
| 1388 unittest.main() | 1381 unittest.main() |
| 1389 | 1382 |
| 1390 # vim: ts=2:sw=2:tw=80:et: | 1383 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |