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

Unified Diff: tests/gclient_utils_test.py

Issue 502078: Remove trychange.RunCommand and replace it by gclient_utils.CheckCall. (Closed)
Patch Set: Created 11 years 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 | « gclient_utils.py ('k') | tests/trychange_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/gclient_utils_test.py
diff --git a/tests/gclient_utils_test.py b/tests/gclient_utils_test.py
index 71a63e4a6d70a2c3d61d291293d7d1e0126890f4..ca5b14a9ea7cd0cbe1ab4dcad814473fb4eb34f3 100644
--- a/tests/gclient_utils_test.py
+++ b/tests/gclient_utils_test.py
@@ -9,6 +9,55 @@ import StringIO
import gclient_utils
from super_mox import SuperMoxTestBase
+
+class GclientUtilsUnittest(SuperMoxTestBase):
+ """General gclient_utils.py tests."""
+ def testMembersChanged(self):
+ members = [
+ 'CheckCall', 'CheckCallError', 'Error', 'FileRead', 'FileWrite',
+ 'FullUrlFromRelative', 'FullUrlFromRelative2', 'GetNamedNodeText',
+ 'GetNodeNamedAttributeText', 'IsUsingGit', 'ParseXML',
+ 'PrintableObject', 'RemoveDirectory', 'SplitUrlRevision',
+ 'SubprocessCall', 'SubprocessCallAndFilter', 'errno', 'os', 're',
+ 'stat', 'subprocess', 'sys', 'time', 'xml',
+ ]
+ # If this test fails, you should add the relevant test.
+ self.compareMembers(gclient_utils, members)
+
+
+class CheckCallTestCase(SuperMoxTestBase):
+ def testCheckCallSuccess(self):
+ command = ['boo', 'foo', 'bar']
+ process = self.mox.CreateMockAnything()
+ process.retcode = 0
+ gclient_utils.subprocess.Popen(
+ command, cwd=None,
+ stdout=gclient_utils.subprocess.PIPE,
+ shell=gclient_utils.sys.platform.startswith('win')).AndReturn(process)
+ process.communicate().AndReturn(['bleh'])
+ self.mox.ReplayAll()
+ gclient_utils.CheckCall(command)
+
+ def testCheckCallFailure(self):
+ command = ['boo', 'foo', 'bar']
+ process = self.mox.CreateMockAnything()
+ process.retcode = 42
+ gclient_utils.subprocess.Popen(
+ command, cwd=None,
+ stdout=gclient_utils.subprocess.PIPE,
+ shell=gclient_utils.sys.platform.startswith('win')).AndReturn(process)
+ process.communicate().AndReturn(['bleh'])
+ self.mox.ReplayAll()
+ try:
+ gclient_utils.CheckCall(command)
+ self.fail()
+ except gclient_utils.CheckCallError, e:
+ self.assertEqual(e.command, command)
+ self.assertEqual(e.cwd, None)
+ self.assertEqual(e.retcode, 42)
+ self.assertEqual(e.stdout, 'bleh')
+
+
class SubprocessCallAndFilterTestCase(SuperMoxTestBase):
def testSubprocessCallAndFilter(self):
command = ['boo', 'foo', 'bar']
« no previous file with comments | « gclient_utils.py ('k') | tests/trychange_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698