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

Unified Diff: tests/presubmit_unittest.py

Issue 10654002: Pass arguments to pylint child process via a pipe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Addressed nit. Created 8 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 | « pylint.py ('k') | third_party/pylint.py » ('j') | 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 d4c0ac59d36dd59ec7a7956a8910771890750f4d..ce3f63082eda8b5a851d8ecaf2b9e55c2e9424d1 100755
--- a/tests/presubmit_unittest.py
+++ b/tests/presubmit_unittest.py
@@ -10,6 +10,7 @@
import logging
import os
import StringIO
+import subprocess
import sys
import time
@@ -2143,9 +2144,18 @@ class CannedChecksUnittest(PresubmitTestsBase):
input_api.os_walk('/foo').AndReturn([('/foo', [], ['file1.py'])])
pylint = os.path.join(_ROOT, 'third_party', 'pylint.py')
pylintrc = os.path.join(_ROOT, 'pylintrc')
- input_api.subprocess.call(
- ['pyyyyython', pylint, 'file1.py', '--rcfile=%s' % pylintrc],
- env=mox.IgnoreArg())
+
+ # Create a mock Popen object, and set up its expectations.
+ child = self.mox.CreateMock(subprocess.Popen)
+ child.stdin = self.mox.CreateMock(file)
+ child.stdin.write('file1.py\n')
+ child.stdin.write('--rcfile=%s\n' % pylintrc)
+ child.stdin.close()
+ child.communicate()
+ child.returncode = 0
+
+ input_api.subprocess.Popen(['pyyyyython', pylint, '--args-on-stdin'],
+ env=mox.IgnoreArg(), stdin=subprocess.PIPE).AndReturn(child)
self.mox.ReplayAll()
results = presubmit_canned_checks.RunPylint(
« no previous file with comments | « pylint.py ('k') | third_party/pylint.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698