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

Unified Diff: tests/git_drover_test.py

Issue 2067653002: drover win: Use --stdin so update-index doesn't fail on long cmdline (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: fix mocky methods Created 4 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 | « git_drover.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/git_drover_test.py
diff --git a/tests/git_drover_test.py b/tests/git_drover_test.py
index 98f9352ede1da63b01b8a2d0e660c4d96484c194..ea38df6006dc4c3e9c884fc4b90b219987469ba4 100755
--- a/tests/git_drover_test.py
+++ b/tests/git_drover_test.py
@@ -37,6 +37,8 @@ class GitDroverTest(auto_stub.TestCase):
self.mock(__builtins__, 'raw_input', self._get_input)
self.mock(subprocess, 'check_call', self._check_call)
self.mock(subprocess, 'check_output', self._check_call)
+ self.real_popen = subprocess.Popen
+ self.mock(subprocess, 'Popen', self._Popen)
self._commands = []
self._input = []
self._fail_on_command = None
@@ -75,7 +77,7 @@ class GitDroverTest(auto_stub.TestCase):
]
self.MANUAL_RESOLVE_PREPARATION_COMMANDS = [
(['git', 'status', '--porcelain'], self._target_repo),
- (['git', 'update-index', '--skip-worktree', '--', 'foo', 'bar'],
+ (['git', 'update-index', '--skip-worktree', '--stdin'],
self._target_repo),
]
self.FINISH_MANUAL_RESOLVE_COMMANDS = [
@@ -113,6 +115,25 @@ class GitDroverTest(auto_stub.TestCase):
return ' D foo\nUU baz\n D bar\n'
return ''
+ def _Popen(self, args, shell=False, cwd=None, stdin=None, stdout=None,
+ stderr=None):
+ if args == ['git', 'update-index', '--skip-worktree', '--stdin']:
+ self._commands.append((args, cwd))
+ self.assertFalse(shell)
+ self.assertEqual(stdin, subprocess.PIPE)
+ class MockPopen(object):
+ def __init__(self, *args, **kwargs):
+ self.returncode = -999
+ def communicate(self, stdin):
+ if stdin == 'foo\nbar\n':
+ self.returncode = 0
+ else:
+ self.returncode = 1
+ return MockPopen()
+ else:
+ return self.real_popen(args, shell=shell, cwd=cwd, stdin=stdin,
+ stdout=stdout, stderr=stderr)
+
def testSuccess(self):
self._input = ['y', 'y']
git_drover.cherry_pick_change('branch', 'cl', self._parent_repo, False)
« no previous file with comments | « git_drover.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698