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

Unified Diff: tests/gclient_utils_test.py

Issue 7906009: Fix a typo that resulted in no tests to be run in depot_tools. :( (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: More Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/gclient_smoketest.py ('k') | tests/presubmit_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 59d5eb7d0e3031e29451f5a346e504e954c29eae..ea1c6f06e102f36f9b57e2c7ae32fe91331db84d 100755
--- a/tests/gclient_utils_test.py
+++ b/tests/gclient_utils_test.py
@@ -5,73 +5,43 @@
# pylint: disable=E1101,W0403
+import os
import StringIO
# Fixes include path.
from super_mox import SuperMoxTestBase
import trial_dir
-import os
+
import gclient_utils
+import subprocess2
class GclientUtilBase(SuperMoxTestBase):
def setUp(self):
super(GclientUtilBase, self).setUp()
gclient_utils.sys.stdout.flush = lambda: None
- self.mox.StubOutWithMock(gclient_utils, 'Popen')
+ self.mox.StubOutWithMock(subprocess2, 'Popen')
+ self.mox.StubOutWithMock(subprocess2, 'communicate')
class GclientUtilsUnittest(GclientUtilBase):
"""General gclient_utils.py tests."""
def testMembersChanged(self):
members = [
- 'CheckCall', 'CheckCallError', 'CheckCallAndFilter',
+ 'CheckCallAndFilter',
'CheckCallAndFilterAndHeader', 'Error', 'ExecutionQueue', 'FileRead',
'FileWrite', 'FindFileUpwards', 'FindGclientRoot',
'GetGClientRootAndEntries', 'IsDateRevision', 'MakeDateRevision',
- 'MakeFileAutoFlush', 'MakeFileAnnotated', 'PathDifference', 'Popen',
+ 'MakeFileAutoFlush', 'MakeFileAnnotated', 'PathDifference',
'PrintableObject', 'RemoveDirectory', 'SoftClone', 'SplitUrlRevision',
'SyntaxErrorToError', 'WorkItem',
- 'errno', 'hack_subprocess', 'logging', 'os', 'Queue', 're', 'rmtree',
- 'stat', 'subprocess', 'sys','threading', 'time',
+ 'errno', 'logging', 'os', 'Queue', 're', 'rmtree',
+ 'stat', 'subprocess2', 'sys','threading', 'time',
]
# If this test fails, you should add the relevant test.
self.compareMembers(gclient_utils, members)
-class CheckCallTestCase(GclientUtilBase):
- def testCheckCallSuccess(self):
- args = ['boo', 'foo', 'bar']
- process = self.mox.CreateMockAnything()
- process.returncode = 0
- gclient_utils.Popen(
- args, cwd='bar',
- stderr=None,
- stdout=gclient_utils.subprocess.PIPE).AndReturn(process)
- process.communicate().AndReturn(['bleh', 'foo'])
- self.mox.ReplayAll()
- gclient_utils.CheckCall(args, cwd='bar')
-
- def testCheckCallFailure(self):
- args = ['boo', 'foo', 'bar']
- process = self.mox.CreateMockAnything()
- process.returncode = 42
- gclient_utils.Popen(
- args,
- stderr=None,
- stdout=gclient_utils.subprocess.PIPE).AndReturn(process)
- process.communicate().AndReturn(['bleh', 'foo'])
- self.mox.ReplayAll()
- try:
- gclient_utils.CheckCall(args)
- self.fail()
- except gclient_utils.CheckCallError, e:
- self.assertEqual(e.command, args)
- self.assertEqual(e.cwd, None)
- self.assertEqual(e.returncode, 42)
- self.assertEqual(e.stdout, 'bleh')
- self.assertEqual(e.stderr, 'foo')
-
class CheckCallAndFilterTestCase(GclientUtilBase):
class ProcessIdMock(object):
@@ -86,11 +56,11 @@ class CheckCallAndFilterTestCase(GclientUtilBase):
'\n________ running \'boo foo bar\' in \'bleh\'\n')
for i in test_string:
gclient_utils.sys.stdout.write(i)
- gclient_utils.Popen(
+ subprocess2.Popen(
args,
cwd=cwd,
- stdout=gclient_utils.subprocess.PIPE,
- stderr=gclient_utils.subprocess.STDOUT,
+ stdout=subprocess2.PIPE,
+ stderr=subprocess2.STDOUT,
bufsize=0).AndReturn(self.ProcessIdMock(test_string))
self.mox.ReplayAll()
« no previous file with comments | « tests/gclient_smoketest.py ('k') | tests/presubmit_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698