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 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 self.assert_(gclient_scm.os.path.isfile(join(base_path, 'a'))) | 724 self.assert_(gclient_scm.os.path.isfile(join(base_path, 'a'))) |
725 self.assertEquals(scm.revinfo(options, (), None), | 725 self.assertEquals(scm.revinfo(options, (), None), |
726 '069c602044c5388d2d15c3f875b057c852003458') | 726 '069c602044c5388d2d15c3f875b057c852003458') |
727 finally: | 727 finally: |
728 rmtree(root_dir) | 728 rmtree(root_dir) |
729 self.checkstdout( | 729 self.checkstdout( |
730 ('\n_____ foo at refs/heads/master\n\n' | 730 ('\n_____ foo at refs/heads/master\n\n' |
731 '________ running \'git clone -b master --verbose %s %s\' in \'%s\'\n' | 731 '________ running \'git clone -b master --verbose %s %s\' in \'%s\'\n' |
732 'Initialized empty Git repository in %s\n') % | 732 'Initialized empty Git repository in %s\n') % |
733 (join(self.root_dir, '.', '.git'), join(root_dir, 'foo'), root_dir, | 733 (join(self.root_dir, '.', '.git'), join(root_dir, 'foo'), root_dir, |
734 join(root_dir, 'foo', '.git') + '/')) | 734 join(gclient_scm.os.path.realpath(root_dir), 'foo', '.git') + '/')) |
735 | 735 |
736 def testUpdateUpdate(self): | 736 def testUpdateUpdate(self): |
737 if not self.enabled: | 737 if not self.enabled: |
738 return | 738 return |
739 options = self.Options() | 739 options = self.Options() |
740 expected_file_list = [join(self.base_path, x) for x in ['a', 'b']] | 740 expected_file_list = [join(self.base_path, x) for x in ['a', 'b']] |
741 scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir, | 741 scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir, |
742 relpath=self.relpath) | 742 relpath=self.relpath) |
743 file_list = [] | 743 file_list = [] |
744 scm.update(options, (), file_list) | 744 scm.update(options, (), file_list) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir, | 817 scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir, |
818 relpath=self.relpath) | 818 relpath=self.relpath) |
819 rev_info = scm.revinfo(options, (), None) | 819 rev_info = scm.revinfo(options, (), None) |
820 self.assertEquals(rev_info, '069c602044c5388d2d15c3f875b057c852003458') | 820 self.assertEquals(rev_info, '069c602044c5388d2d15c3f875b057c852003458') |
821 | 821 |
822 | 822 |
823 if __name__ == '__main__': | 823 if __name__ == '__main__': |
824 unittest.main() | 824 unittest.main() |
825 | 825 |
826 # vim: ts=2:sw=2:tw=80:et: | 826 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |