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

Unified Diff: tests/presubmit_unittest.py

Issue 1193333012: Fix depot_tools presubmit tests by mocking multiprocessing.cpu_count. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 5 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 | « no previous file | 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 f37bf6ca6b3c14ec38e74f9ac3026dd6f311b8f3..3bec7733c92ffaca5fd5396e927a7b716d34eae0 100755
--- a/tests/presubmit_unittest.py
+++ b/tests/presubmit_unittest.py
@@ -7,11 +7,12 @@
# pylint: disable=E1101,E1103
+import StringIO
import functools
import itertools
import logging
+import multiprocessing
import os
-import StringIO
import sys
import time
import unittest
@@ -156,6 +157,10 @@ def GetPreferredTryMasters(project, change):
self.mox.StubOutWithMock(presubmit.scm.SVN, 'GenerateDiff')
self.mox.StubOutWithMock(presubmit.scm.GIT, 'GenerateDiff')
+ # On some platforms this does all sorts of undesirable system calls, so
+ # just permanently mock it with a lambda that returns 2
+ multiprocessing.cpu_count = lambda: 2
+
class PresubmitUnittest(PresubmitTestsBase):
"""General presubmit_support.py tests (excluding InputApi and OutputApi)."""
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698