| 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 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 "in '%s'\n" | 941 "in '%s'\n" |
| 942 "Initialized empty Git repository in %s\n") % ( | 942 "Initialized empty Git repository in %s\n") % ( |
| 943 join(self.root_dir, '.', '.git'), | 943 join(self.root_dir, '.', '.git'), |
| 944 join(root_dir, 'foo'), | 944 join(root_dir, 'foo'), |
| 945 root_dir, | 945 root_dir, |
| 946 join(gclient_scm.os.path.realpath(root_dir), 'foo', '.git') + '/') | 946 join(gclient_scm.os.path.realpath(root_dir), 'foo', '.git') + '/') |
| 947 msg2 = ( | 947 msg2 = ( |
| 948 "\n_____ foo at refs/heads/master\n\n" | 948 "\n_____ foo at refs/heads/master\n\n" |
| 949 "________ running 'git clone --progress -b master --verbose %s %s'" | 949 "________ running 'git clone --progress -b master --verbose %s %s'" |
| 950 " in '%s'\n" | 950 " in '%s'\n" |
| 951 "Cloning into %s...\ndone.\n") % ( | 951 "Cloning into '%s'...\ndone.\n") % ( |
| 952 join(self.root_dir, '.', '.git'), | 952 join(self.root_dir, '.', '.git'), |
| 953 join(root_dir, 'foo'), | 953 join(root_dir, 'foo'), |
| 954 root_dir, | 954 root_dir, |
| 955 join(gclient_scm.os.path.realpath(root_dir), 'foo')) | 955 join(gclient_scm.os.path.realpath(root_dir), 'foo')) |
| 956 out = sys.stdout.getvalue() | 956 out = sys.stdout.getvalue() |
| 957 sys.stdout.close() | 957 sys.stdout.close() |
| 958 sys.stdout = self._old_stdout | 958 sys.stdout = self._old_stdout |
| 959 self.assertTrue(out in (msg1, msg2), (out, msg1, msg2)) | 959 self.assertTrue(out in (msg1, msg2), (out, msg1, msg2)) |
| 960 | 960 |
| 961 def testUpdateUpdate(self): | 961 def testUpdateUpdate(self): |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1256 " in '%s'\n" | 1256 " in '%s'\n" |
| 1257 "Initialized empty Git repository in %s\n") % ( | 1257 "Initialized empty Git repository in %s\n") % ( |
| 1258 join(self.root_dir, '.', '.git'), | 1258 join(self.root_dir, '.', '.git'), |
| 1259 join(root_dir, 'foo'), | 1259 join(root_dir, 'foo'), |
| 1260 root_dir, | 1260 root_dir, |
| 1261 join(gclient_scm.os.path.realpath(root_dir), 'foo', '.git') + '/') | 1261 join(gclient_scm.os.path.realpath(root_dir), 'foo', '.git') + '/') |
| 1262 msg2 = ( | 1262 msg2 = ( |
| 1263 "\n_____ foo at refs/heads/master\n\n" | 1263 "\n_____ foo at refs/heads/master\n\n" |
| 1264 "________ running 'git clone --progress -b master --verbose %s %s'" | 1264 "________ running 'git clone --progress -b master --verbose %s %s'" |
| 1265 " in '%s'\n" | 1265 " in '%s'\n" |
| 1266 "Cloning into %s...\ndone.\n") % ( | 1266 "Cloning into '%s'...\ndone.\n") % ( |
| 1267 join(self.root_dir, '.', '.git'), | 1267 join(self.root_dir, '.', '.git'), |
| 1268 join(root_dir, 'foo'), | 1268 join(root_dir, 'foo'), |
| 1269 root_dir, | 1269 root_dir, |
| 1270 join(gclient_scm.os.path.realpath(root_dir), 'foo')) | 1270 join(gclient_scm.os.path.realpath(root_dir), 'foo')) |
| 1271 out = sys.stdout.getvalue() | 1271 out = sys.stdout.getvalue() |
| 1272 sys.stdout.close() | 1272 sys.stdout.close() |
| 1273 sys.stdout = self._old_stdout | 1273 sys.stdout = self._old_stdout |
| 1274 self.assertTrue(out in (msg1, msg2), (out, msg1, msg2)) | 1274 self.assertTrue(out in (msg1, msg2), (out, msg1, msg2)) |
| 1275 | 1275 |
| 1276 def testUpdateUpdate(self): | 1276 def testUpdateUpdate(self): |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1291 | 1291 |
| 1292 if __name__ == '__main__': | 1292 if __name__ == '__main__': |
| 1293 if '-v' in sys.argv: | 1293 if '-v' in sys.argv: |
| 1294 logging.basicConfig( | 1294 logging.basicConfig( |
| 1295 level=logging.DEBUG, | 1295 level=logging.DEBUG, |
| 1296 format='%(asctime).19s %(levelname)s %(filename)s:' | 1296 format='%(asctime).19s %(levelname)s %(filename)s:' |
| 1297 '%(lineno)s %(message)s') | 1297 '%(lineno)s %(message)s') |
| 1298 unittest.main() | 1298 unittest.main() |
| 1299 | 1299 |
| 1300 # vim: ts=2:sw=2:tw=80:et: | 1300 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |