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

Unified Diff: tests/gcl_unittest.py

Issue 392006: Cleanup the unit tests by mocking more system functions. (Closed)
Patch Set: Created 11 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/gclient_scm_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/gcl_unittest.py
diff --git a/tests/gcl_unittest.py b/tests/gcl_unittest.py
index f4dbf34adfa52e4f12be1597492e53ecbb95a261..739840bb71a91cfb4871581d9b38053dfc476599 100755
--- a/tests/gcl_unittest.py
+++ b/tests/gcl_unittest.py
@@ -5,29 +5,18 @@
"""Unit tests for gcl.py."""
-import unittest
-
# Local imports
import gcl
-import super_mox
-from super_mox import mox
+from super_mox import mox, SuperMoxTestBase
-class GclTestsBase(super_mox.SuperMoxTestBase):
+class GclTestsBase(SuperMoxTestBase):
"""Setups and tear downs the mocks but doesn't test anything as-is."""
def setUp(self):
- super_mox.SuperMoxTestBase.setUp(self)
+ SuperMoxTestBase.setUp(self)
self.fake_root_dir = self.RootDir()
self.mox.StubOutWithMock(gcl, 'RunShell')
self.mox.StubOutWithMock(gcl.gclient_scm, 'CaptureSVNInfo')
- self.mox.StubOutWithMock(gcl.os, 'getcwd')
- self.mox.StubOutWithMock(gcl.os, 'chdir')
- self.mox.StubOutWithMock(gcl.os, 'close')
- self.mox.StubOutWithMock(gcl.os, 'remove')
- self.mox.StubOutWithMock(gcl.os, 'write')
- self.mox.StubOutWithMock(gcl.os.path, 'exists')
- self.mox.StubOutWithMock(gcl.os.path, 'isdir')
- self.mox.StubOutWithMock(gcl.os.path, 'isfile')
self.mox.StubOutWithMock(gcl, 'tempfile')
self.mox.StubOutWithMock(gcl.upload, 'RealMain')
# These are not tested.
@@ -40,9 +29,9 @@ class GclUnittest(GclTestsBase):
def testMembersChanged(self):
self.mox.ReplayAll()
members = [
- 'CODEREVIEW_SETTINGS', 'CODEREVIEW_SETTINGS_FILE',
+ 'CODEREVIEW_SETTINGS', 'CODEREVIEW_SETTINGS_FILE',
'Change', 'ChangeInfo', 'Changes', 'Commit',
- 'DEFAULT_LINT_IGNORE_REGEX', 'DEFAULT_LINT_REGEX',
+ 'DEFAULT_LINT_IGNORE_REGEX', 'DEFAULT_LINT_REGEX',
'DeleteEmptyChangeLists', 'DoPresubmitChecks',
'ErrorExit', 'FILES_CACHE', 'FilterFlag', 'GenerateChangeName',
'GenerateDiff',
@@ -134,7 +123,6 @@ class GclUnittest(GclTestsBase):
pass
def testHelp(self):
- self.mox.StubOutWithMock(gcl.sys, 'stdout')
gcl.sys.stdout.write(mox.StrContains('GCL is a wrapper for Subversion'))
gcl.sys.stdout.write('\n')
self.mox.ReplayAll()
@@ -364,4 +352,5 @@ class UploadCLUnittest(GclTestsBase):
if __name__ == '__main__':
+ import unittest
unittest.main()
« no previous file with comments | « no previous file | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698