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

Side by Side Diff: tests/gclient_scm_test.py

Issue 2425003: Fix both gclient_scm_test.py and scm_unittest.py. (Closed)
Patch Set: Created 10 years, 6 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 | tests/scm_unittest.py » ('j') | 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 # 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
11 from subprocess import Popen, PIPE, STDOUT 11 from subprocess import Popen, PIPE, STDOUT
12 import tempfile 12 import tempfile
13 import __builtin__ 13 import __builtin__
14 14
15 # Fixes include path. 15 # Fixes include path.
16 from super_mox import mox, SuperMoxBaseTestBase, SuperMoxTestBase 16 from super_mox import mox, SuperMoxBaseTestBase, SuperMoxTestBase
17 17
18 import gclient_scm 18 import gclient_scm
19 from gclient_test import BaseTestCase as GCBaseTestCase 19
20
21 class GCBaseTestCase(SuperMoxTestBase):
22 # Like unittest's assertRaises, but checks for Gclient.Error.
23 def assertRaisesError(self, msg, fn, *args, **kwargs):
24 try:
25 fn(*args, **kwargs)
26 except gclient_scm.gclient_utils.Error, e:
27 self.assertEquals(e.args[0], msg)
28 else:
29 self.fail('%s not raised' % msg)
20 30
21 31
22 class BaseTestCase(GCBaseTestCase): 32 class BaseTestCase(GCBaseTestCase):
23 def setUp(self): 33 def setUp(self):
24 GCBaseTestCase.setUp(self) 34 GCBaseTestCase.setUp(self)
25 self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'FileRead') 35 self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'FileRead')
26 self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'FileWrite') 36 self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'FileWrite')
27 self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'SubprocessCall') 37 self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'SubprocessCall')
28 self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'RemoveDirectory') 38 self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'RemoveDirectory')
29 self._CaptureSVNInfo = gclient_scm.scm.SVN.CaptureInfo 39 self._CaptureSVNInfo = gclient_scm.scm.SVN.CaptureInfo
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 relpath=self.relpath) 736 relpath=self.relpath)
727 rev_info = scm.revinfo(options, (), None) 737 rev_info = scm.revinfo(options, (), None)
728 self.assertEquals(rev_info, '069c602044c5388d2d15c3f875b057c852003458') 738 self.assertEquals(rev_info, '069c602044c5388d2d15c3f875b057c852003458')
729 739
730 740
731 if __name__ == '__main__': 741 if __name__ == '__main__':
732 import unittest 742 import unittest
733 unittest.main() 743 unittest.main()
734 744
735 # vim: ts=2:sw=2:tw=80:et: 745 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « no previous file | tests/scm_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698