| 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 """Unit tests for gclient_scm.py.""" | 6 """Unit tests for gclient_scm.py.""" |
| 7 | 7 |
| 8 # Import before super_mox to keep valid references. | 8 # Import before super_mox to keep valid references. |
| 9 from os import rename | 9 from os import rename |
| 10 from shutil import rmtree | 10 from shutil import rmtree |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 GCBaseTestCase.setUp(self) | 590 GCBaseTestCase.setUp(self) |
| 591 TestCaseUtils.setUp(self) | 591 TestCaseUtils.setUp(self) |
| 592 unittest.TestCase.setUp(self) | 592 unittest.TestCase.setUp(self) |
| 593 self.url = 'git://foo' | 593 self.url = 'git://foo' |
| 594 self.root_dir = tempfile.mkdtemp() | 594 self.root_dir = tempfile.mkdtemp() |
| 595 self.relpath = '.' | 595 self.relpath = '.' |
| 596 self.base_path = gclient_scm.os.path.join(self.root_dir, self.relpath) | 596 self.base_path = gclient_scm.os.path.join(self.root_dir, self.relpath) |
| 597 self.enabled = self.CreateGitRepo(self.sample_git_import, self.base_path) | 597 self.enabled = self.CreateGitRepo(self.sample_git_import, self.base_path) |
| 598 | 598 |
| 599 def tearDown(self): | 599 def tearDown(self): |
| 600 if not self.enabled: |
| 601 self.checkstdout('') |
| 600 GCBaseTestCase.tearDown(self) | 602 GCBaseTestCase.tearDown(self) |
| 601 TestCaseUtils.tearDown(self) | 603 TestCaseUtils.tearDown(self) |
| 602 unittest.TestCase.tearDown(self) | 604 unittest.TestCase.tearDown(self) |
| 603 rmtree(self.root_dir) | 605 rmtree(self.root_dir) |
| 604 | 606 |
| 605 def testDir(self): | 607 def testDir(self): |
| 606 members = [ | 608 members = [ |
| 607 'FullUrlForRelativeUrl', 'RunCommand', | 609 'FullUrlForRelativeUrl', 'RunCommand', |
| 608 'cleanup', 'diff', 'export', 'pack', 'relpath', 'revert', | 610 'cleanup', 'diff', 'export', 'pack', 'relpath', 'revert', |
| 609 'revinfo', 'runhooks', 'status', 'update', 'url', | 611 'revinfo', 'runhooks', 'status', 'update', 'url', |
| 610 ] | 612 ] |
| 611 | 613 |
| 612 # If you add a member, be sure to add the relevant test! | 614 # If you add a member, be sure to add the relevant test! |
| 613 self.compareMembers(gclient_scm.CreateSCM(url=self.url), members) | 615 self.compareMembers(gclient_scm.CreateSCM(url=self.url), members) |
| 614 self.checkstdout('') | 616 if self.enabled: |
| 617 self.checkstdout('') |
| 615 | 618 |
| 616 def testRevertMissing(self): | 619 def testRevertMissing(self): |
| 617 if not self.enabled: | 620 if not self.enabled: |
| 618 return | 621 return |
| 619 options = self.Options() | 622 options = self.Options() |
| 620 file_path = gclient_scm.os.path.join(self.base_path, 'a') | 623 file_path = gclient_scm.os.path.join(self.base_path, 'a') |
| 621 scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir, | 624 scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir, |
| 622 relpath=self.relpath) | 625 relpath=self.relpath) |
| 623 file_list = [] | 626 file_list = [] |
| 624 scm.update(options, None, file_list) | 627 scm.update(options, None, file_list) |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 relpath=self.relpath) | 868 relpath=self.relpath) |
| 866 rev_info = scm.revinfo(options, (), None) | 869 rev_info = scm.revinfo(options, (), None) |
| 867 self.assertEquals(rev_info, '069c602044c5388d2d15c3f875b057c852003458') | 870 self.assertEquals(rev_info, '069c602044c5388d2d15c3f875b057c852003458') |
| 868 self.checkstdout('') | 871 self.checkstdout('') |
| 869 | 872 |
| 870 | 873 |
| 871 if __name__ == '__main__': | 874 if __name__ == '__main__': |
| 872 unittest.main() | 875 unittest.main() |
| 873 | 876 |
| 874 # vim: ts=2:sw=2:tw=80:et: | 877 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |