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

Unified Diff: tests/presubmit_unittest.py

Issue 119285: Fix presubmit_support.py run standalone and RunPythonUnitTests (Closed)
Patch Set: Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « presubmit_support.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/presubmit_unittest.py
diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py
index fa7dd7e340336112e4f96befa51c843df64cab2b..8135e5f03e120f3d0e6701d6b534aed185306f08 100755
--- a/tests/presubmit_unittest.py
+++ b/tests/presubmit_unittest.py
@@ -969,8 +969,9 @@ class CannedChecksUnittest(PresubmitTestsBase):
def testRunPythonUnitTestsNonExistent1(self):
input_api = self.MockInputApi()
input_api.is_committing = False
- presubmit_canned_checks._RunPythonUnitTests_LoadTests('_non_existent_module'
- ).AndRaise(exceptions.ImportError('Blehh'))
+ presubmit_canned_checks._RunPythonUnitTests_LoadTests(
+ input_api, '_non_existent_module').AndRaise(
+ exceptions.ImportError('Blehh'))
self.mox.ReplayAll()
results = presubmit_canned_checks.RunPythonUnitTests(
input_api, presubmit.OutputApi, ['_non_existent_module'])
@@ -981,8 +982,9 @@ class CannedChecksUnittest(PresubmitTestsBase):
def testRunPythonUnitTestsNonExistent2(self):
input_api = self.MockInputApi()
input_api.is_committing = True
- presubmit_canned_checks._RunPythonUnitTests_LoadTests('_non_existent_module'
- ).AndRaise(exceptions.ImportError('Blehh'))
+ presubmit_canned_checks._RunPythonUnitTests_LoadTests(
+ input_api, '_non_existent_module').AndRaise(
+ exceptions.ImportError('Blehh'))
self.mox.ReplayAll()
results = presubmit_canned_checks.RunPythonUnitTests(
input_api, presubmit.OutputApi, ['_non_existent_module'])
@@ -993,8 +995,8 @@ class CannedChecksUnittest(PresubmitTestsBase):
input_api = self.MockInputApi()
input_api.is_committing = False
test_module = self.mox.CreateMockAnything()
- presubmit_canned_checks._RunPythonUnitTests_LoadTests('test_module'
- ).AndReturn([])
+ presubmit_canned_checks._RunPythonUnitTests_LoadTests(
+ input_api, 'test_module').AndReturn([])
self.mox.ReplayAll()
results = presubmit_canned_checks.RunPythonUnitTests(
@@ -1005,8 +1007,8 @@ class CannedChecksUnittest(PresubmitTestsBase):
input_api = self.MockInputApi()
input_api.is_committing = True
test_module = self.mox.CreateMockAnything()
- presubmit_canned_checks._RunPythonUnitTests_LoadTests('test_module'
- ).AndReturn([])
+ presubmit_canned_checks._RunPythonUnitTests_LoadTests(
+ input_api, 'test_module').AndReturn([])
self.mox.ReplayAll()
results = presubmit_canned_checks.RunPythonUnitTests(
@@ -1018,8 +1020,8 @@ class CannedChecksUnittest(PresubmitTestsBase):
input_api.is_committing = False
input_api.unittest = self.mox.CreateMock(unittest)
test = self.mox.CreateMockAnything()
- presubmit_canned_checks._RunPythonUnitTests_LoadTests('test_module'
- ).AndReturn([test])
+ presubmit_canned_checks._RunPythonUnitTests_LoadTests(
+ input_api, 'test_module').AndReturn([test])
runner = self.mox.CreateMockAnything()
input_api.unittest.TextTestRunner(verbosity=0).AndReturn(runner)
suite = self.mox.CreateMockAnything()
@@ -1027,8 +1029,8 @@ class CannedChecksUnittest(PresubmitTestsBase):
test_result = self.mox.CreateMockAnything()
runner.run(suite).AndReturn(test_result)
test_result.wasSuccessful().AndReturn(False)
- test_result.failures = 2
- test_result.errors = 3
+ test_result.failures = [None, None]
+ test_result.errors = [None, None, None]
self.mox.ReplayAll()
results = presubmit_canned_checks.RunPythonUnitTests(
@@ -1042,8 +1044,8 @@ class CannedChecksUnittest(PresubmitTestsBase):
input_api.is_committing = True
input_api.unittest = self.mox.CreateMock(unittest)
test = self.mox.CreateMockAnything()
- presubmit_canned_checks._RunPythonUnitTests_LoadTests('test_module'
- ).AndReturn([test])
+ presubmit_canned_checks._RunPythonUnitTests_LoadTests(
+ input_api, 'test_module').AndReturn([test])
runner = self.mox.CreateMockAnything()
input_api.unittest.TextTestRunner(verbosity=0).AndReturn(runner)
suite = self.mox.CreateMockAnything()
@@ -1051,8 +1053,8 @@ class CannedChecksUnittest(PresubmitTestsBase):
test_result = self.mox.CreateMockAnything()
runner.run(suite).AndReturn(test_result)
test_result.wasSuccessful().AndReturn(False)
- test_result.failures = 2
- test_result.errors = 3
+ test_result.failures = [None, None]
+ test_result.errors = [None, None, None]
self.mox.ReplayAll()
results = presubmit_canned_checks.RunPythonUnitTests(
@@ -1065,8 +1067,8 @@ class CannedChecksUnittest(PresubmitTestsBase):
input_api.is_committing = False
input_api.unittest = self.mox.CreateMock(unittest)
test = self.mox.CreateMockAnything()
- presubmit_canned_checks._RunPythonUnitTests_LoadTests('test_module'
- ).AndReturn([test])
+ presubmit_canned_checks._RunPythonUnitTests_LoadTests(
+ input_api, 'test_module').AndReturn([test])
runner = self.mox.CreateMockAnything()
input_api.unittest.TextTestRunner(verbosity=0).AndReturn(runner)
suite = self.mox.CreateMockAnything()
« no previous file with comments | « presubmit_support.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698