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

Side by Side Diff: tests/gclient_test.py

Issue 214017: gclient_scm: add test to catch bug fixed by r208010 (Closed)
Patch Set: add bug explanation Created 11 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 | « no previous file | 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/python 1 #!/usr/bin/python
2 # 2 #
3 # Copyright 2008-2009 Google Inc. All Rights Reserved. 3 # Copyright 2008-2009 Google Inc. All Rights Reserved.
4 # 4 #
5 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License. 6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at 7 # You may obtain a copy of the License at
8 # 8 #
9 # http://www.apache.org/licenses/LICENSE-2.0 9 # http://www.apache.org/licenses/LICENSE-2.0
10 # 10 #
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 1110
1111 print(os.path.join(base_path, 'a')) 1111 print(os.path.join(base_path, 'a'))
1112 print(os.path.join(base_path, 'b')) 1112 print(os.path.join(base_path, 'b'))
1113 gclient_scm.RunSVN(['revert', 'a', 'b'], base_path) 1113 gclient_scm.RunSVN(['revert', 'a', 'b'], base_path)
1114 1114
1115 self.mox.ReplayAll() 1115 self.mox.ReplayAll()
1116 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, 1116 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
1117 relpath=self.relpath) 1117 relpath=self.relpath)
1118 file_list = [] 1118 file_list = []
1119 scm.revert(options, self.args, file_list) 1119 scm.revert(options, self.args, file_list)
1120 self.assertEquals(sorted(file_list), sorted([os.path.join(base_path, 'a'),
1121 os.path.join(base_path, 'b')]))
1120 1122
1121 def testRevertUnversionedUnexpectedFile(self): 1123 def testRevertUnversionedUnexpectedFile(self):
1122 options = self.Options(verbose=True) 1124 options = self.Options(verbose=True)
1123 base_path = os.path.join(self.root_dir, self.relpath) 1125 base_path = os.path.join(self.root_dir, self.relpath)
1124 gclient.os.path.isdir(base_path).AndReturn(True) 1126 gclient.os.path.isdir(base_path).AndReturn(True)
1125 items = [ 1127 items = [
1126 ('~ ', 'a'), 1128 ('~ ', 'a'),
1127 ] 1129 ]
1128 gclient_scm.CaptureSVNStatus(base_path).AndReturn(items) 1130 gclient_scm.CaptureSVNStatus(base_path).AndReturn(items)
1129 file_path = os.path.join(base_path, 'a') 1131 file_path = os.path.join(base_path, 'a')
1130 print(file_path) 1132 print(file_path)
1131 gclient_scm.os.remove(file_path).AndRaise(EnvironmentError()) 1133 gclient_scm.os.remove(file_path).AndRaise(EnvironmentError())
1132 gclient_utils.RemoveDirectory(file_path) 1134 gclient_utils.RemoveDirectory(file_path)
1133 gclient_scm.RunSVN(['revert', 'a'], base_path) 1135 gclient_scm.RunSVN(['revert', 'a'], base_path)
1134 1136
1135 self.mox.ReplayAll() 1137 self.mox.ReplayAll()
1136 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, 1138 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
1137 relpath=self.relpath) 1139 relpath=self.relpath)
1138 file_list = [] 1140 file_list = []
1139 scm.revert(options, self.args, file_list) 1141 scm.revert(options, self.args, file_list)
1142 # TODO(msb): fix bug (file_list contains dupes) and enable assertion
1143 #self.assertEquals(file_list, [os.path.join(base_path, 'a')])
1140 1144
1141 def testStatus(self): 1145 def testStatus(self):
1142 options = self.Options(verbose=True) 1146 options = self.Options(verbose=True)
1143 base_path = os.path.join(self.root_dir, self.relpath) 1147 base_path = os.path.join(self.root_dir, self.relpath)
1144 gclient.os.path.isdir(base_path).AndReturn(True) 1148 gclient.os.path.isdir(base_path).AndReturn(True)
1145 gclient_scm.RunSVNAndGetFileList(['status'] + self.args, base_path, 1149 gclient_scm.RunSVNAndGetFileList(['status'] + self.args, base_path,
1146 []).AndReturn(None) 1150 []).AndReturn(None)
1147 1151
1148 self.mox.ReplayAll() 1152 self.mox.ReplayAll()
1149 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, 1153 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1403 """ 1407 """
1404 gclient_scm.CaptureSVN = CaptureSVNMock 1408 gclient_scm.CaptureSVN = CaptureSVNMock
1405 info = gclient_scm.CaptureSVNStatus(None) 1409 info = gclient_scm.CaptureSVNStatus(None)
1406 self.assertEquals(info, []) 1410 self.assertEquals(info, [])
1407 1411
1408 1412
1409 if __name__ == '__main__': 1413 if __name__ == '__main__':
1410 unittest.main() 1414 unittest.main()
1411 1415
1412 # vim: ts=2:sw=2:tw=80:et: 1416 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698