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

Side by Side Diff: tests/scm_unittest.py

Issue 189913020: gclient: print a warning if a dep would get deleted or moved in the future (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: rebase+fix Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « tests/gclient_smoketest.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 scm.py.""" 6 """Unit tests for scm.py."""
7 7
8 import logging 8 import logging
9 import os 9 import os
10 import sys 10 import sys
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 kwargs.setdefault('cwd', self.clone_dir) 165 kwargs.setdefault('cwd', self.clone_dir)
166 return scm.GIT.Capture(cmd, **kwargs) 166 return scm.GIT.Capture(cmd, **kwargs)
167 167
168 def testGetGitSvnHeadRev(self): 168 def testGetGitSvnHeadRev(self):
169 if not self.enabled: 169 if not self.enabled:
170 return 170 return
171 self.assertEquals(scm.GIT.GetGitSvnHeadRev(cwd=self.clone_dir), 2) 171 self.assertEquals(scm.GIT.GetGitSvnHeadRev(cwd=self.clone_dir), 2)
172 self._capture(['reset', '--hard', 'HEAD^']) 172 self._capture(['reset', '--hard', 'HEAD^'])
173 self.assertEquals(scm.GIT.GetGitSvnHeadRev(cwd=self.clone_dir), 1) 173 self.assertEquals(scm.GIT.GetGitSvnHeadRev(cwd=self.clone_dir), 1)
174 174
175 def testIsGitSvn(self):
176 if not self.enabled:
177 return
178 # Git-svn
179 self.assertTrue(scm.GIT.IsGitSvn(self.clone_dir))
180 # Pure git
181 git_dir = scm.os.path.join(self.FAKE_REPOS.git_root, 'repo_1')
182 self.assertFalse(scm.GIT.IsGitSvn(git_dir))
183 # Pure svn
184 svn_dir = scm.os.path.join(self.FAKE_REPOS.svn_checkout, 'trunk')
185 self.assertFalse(scm.GIT.IsGitSvn(svn_dir))
186
175 def testParseGitSvnSha1(self): 187 def testParseGitSvnSha1(self):
176 test_sha1 = 'a5c63ce8671922e5c59c0dea49ef4f9d4a3020c9' 188 test_sha1 = 'a5c63ce8671922e5c59c0dea49ef4f9d4a3020c9'
177 expected_output = test_sha1 + '\n' 189 expected_output = test_sha1 + '\n'
178 # Cygwin git-svn 1.7.9 prints extra escape sequences when run under 190 # Cygwin git-svn 1.7.9 prints extra escape sequences when run under
179 # TERM=xterm 191 # TERM=xterm
180 cygwin_output = test_sha1 + '\n\033[?1034h' 192 cygwin_output = test_sha1 + '\n\033[?1034h'
181 193
182 self.assertEquals(scm.GIT.ParseGitSvnSha1(expected_output), test_sha1) 194 self.assertEquals(scm.GIT.ParseGitSvnSha1(expected_output), test_sha1)
183 self.assertEquals(scm.GIT.ParseGitSvnSha1(cygwin_output), test_sha1) 195 self.assertEquals(scm.GIT.ParseGitSvnSha1(cygwin_output), test_sha1)
184 196
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 # Asserting the tree is not sufficient, svn status must come out clear too. 481 # Asserting the tree is not sufficient, svn status must come out clear too.
470 self.assertEquals('', self._capture(['status'])) 482 self.assertEquals('', self._capture(['status']))
471 483
472 484
473 if __name__ == '__main__': 485 if __name__ == '__main__':
474 if '-v' in sys.argv: 486 if '-v' in sys.argv:
475 logging.basicConfig(level=logging.DEBUG) 487 logging.basicConfig(level=logging.DEBUG)
476 unittest.main() 488 unittest.main()
477 489
478 # vim: ts=2:sw=2:tw=80:et: 490 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « tests/gclient_smoketest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698