Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: tests/gclient_scm_test.py

Issue 587253005: Use CheckCallAndFilterAndHeader for git commands. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: update test expectations Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gclient_scm.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 return 1031 return
1032 options = self.Options() 1032 options = self.Options()
1033 file_path = join(self.base_path, 'a') 1033 file_path = join(self.base_path, 'a')
1034 open(file_path, 'a').writelines('touched\n') 1034 open(file_path, 'a').writelines('touched\n')
1035 scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir, 1035 scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir,
1036 relpath=self.relpath) 1036 relpath=self.relpath)
1037 file_list = [] 1037 file_list = []
1038 scm.status(options, self.args, file_list) 1038 scm.status(options, self.args, file_list)
1039 self.assertEquals(file_list, [file_path]) 1039 self.assertEquals(file_list, [file_path])
1040 self.checkstdout( 1040 self.checkstdout(
1041 ('running \'git diff --name-status ' 1041 ('\n________ running \'git diff --name-status '
1042 '069c602044c5388d2d15c3f875b057c852003458\' in \'%s\'\nM\ta\n') % 1042 '069c602044c5388d2d15c3f875b057c852003458\' in \'%s\'\nM\ta\n') %
1043 join(self.root_dir, '.')) 1043 join(self.root_dir, '.'))
1044 1044
1045 def testStatus2New(self): 1045 def testStatus2New(self):
1046 if not self.enabled: 1046 if not self.enabled:
1047 return 1047 return
1048 options = self.Options() 1048 options = self.Options()
1049 expected_file_list = [] 1049 expected_file_list = []
1050 for f in ['a', 'b']: 1050 for f in ['a', 'b']:
1051 file_path = join(self.base_path, f) 1051 file_path = join(self.base_path, f)
1052 open(file_path, 'a').writelines('touched\n') 1052 open(file_path, 'a').writelines('touched\n')
1053 expected_file_list.extend([file_path]) 1053 expected_file_list.extend([file_path])
1054 scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir, 1054 scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir,
1055 relpath=self.relpath) 1055 relpath=self.relpath)
1056 file_list = [] 1056 file_list = []
1057 scm.status(options, self.args, file_list) 1057 scm.status(options, self.args, file_list)
1058 expected_file_list = [join(self.base_path, x) for x in ['a', 'b']] 1058 expected_file_list = [join(self.base_path, x) for x in ['a', 'b']]
1059 self.assertEquals(sorted(file_list), expected_file_list) 1059 self.assertEquals(sorted(file_list), expected_file_list)
1060 self.checkstdout( 1060 self.checkstdout(
1061 ('running \'git diff --name-status ' 1061 ('\n________ running \'git diff --name-status '
1062 '069c602044c5388d2d15c3f875b057c852003458\' in \'%s\'\nM\ta\nM\tb\n') % 1062 '069c602044c5388d2d15c3f875b057c852003458\' in \'%s\'\nM\ta\nM\tb\n') %
1063 join(self.root_dir, '.')) 1063 join(self.root_dir, '.'))
1064 1064
1065 def testUpdateUpdate(self): 1065 def testUpdateUpdate(self):
1066 if not self.enabled: 1066 if not self.enabled:
1067 return 1067 return
1068 options = self.Options() 1068 options = self.Options()
1069 expected_file_list = [join(self.base_path, x) for x in ['a', 'b']] 1069 expected_file_list = [join(self.base_path, x) for x in ['a', 'b']]
1070 scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir, 1070 scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir,
1071 relpath=self.relpath) 1071 relpath=self.relpath)
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
1618 1618
1619 if __name__ == '__main__': 1619 if __name__ == '__main__':
1620 level = logging.DEBUG if '-v' in sys.argv else logging.FATAL 1620 level = logging.DEBUG if '-v' in sys.argv else logging.FATAL
1621 logging.basicConfig( 1621 logging.basicConfig(
1622 level=level, 1622 level=level,
1623 format='%(asctime).19s %(levelname)s %(filename)s:' 1623 format='%(asctime).19s %(levelname)s %(filename)s:'
1624 '%(lineno)s %(message)s') 1624 '%(lineno)s %(message)s')
1625 unittest.main() 1625 unittest.main()
1626 1626
1627 # vim: ts=2:sw=2:tw=80:et: 1627 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « gclient_scm.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698