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

Unified Diff: tools/push-to-trunk/test_scripts.py

Issue 527953002: Refactoring: Unify mocks of different commands in auto roll tests. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/push-to-trunk/test_scripts.py
diff --git a/tools/push-to-trunk/test_scripts.py b/tools/push-to-trunk/test_scripts.py
index 26adedab7773f2bfac89e1db131ca8cd34ca52f5..d2577117ddd14a09b3e524c9b12cd2b98b49a113 100644
--- a/tools/push-to-trunk/test_scripts.py
+++ b/tools/push-to-trunk/test_scripts.py
@@ -365,22 +365,11 @@ class ScriptTest(unittest.TestCase):
print "%s %s" % (cmd, args)
return self._cmd_mock.Call(cmd + " " + args)
- def LogMock(self, cmd, args=""):
- print "Log: %s %s" % (cmd, args)
-
- MOCKS = {
- "gclient": CmdMock,
- "git": CmdMock,
- "roll-dep": CmdMock,
- "svn": CmdMock,
- "vi": LogMock,
- }
-
def Call(self, fun, *args, **kwargs):
print "Calling %s with %s and %s" % (str(fun), str(args), str(kwargs))
def Command(self, cmd, args="", prefix="", pipe=True):
- return ScriptTest.MOCKS[cmd](self, cmd, args)
+ return self.CmdMock(cmd, args)
def ReadLine(self):
return self._rl_mock.Call()
@@ -596,7 +585,9 @@ class ScriptTest(unittest.TestCase):
TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile()
TextToFile(" New \n\tLines \n", TEST_CONFIG[CHANGELOG_ENTRY_FILE])
os.environ["EDITOR"] = "vi"
-
+ self.ExpectCmd([
+ Cmd("vi %s" % TEST_CONFIG[CHANGELOG_ENTRY_FILE], ""),
+ ])
self.ExpectReadline([
RL(""), # Open editor.
])
@@ -742,7 +733,7 @@ Performance and stability improvements on all platforms.""", commit)
change_log)
force_flag = " -f" if not manual else ""
- self.ExpectCmd([
+ expectations = [
Cmd("git status -s -uno", ""),
Cmd("git status -s -b -uno", "## some_branch\n"),
Cmd("git svn fetch", ""),
@@ -767,6 +758,10 @@ Performance and stability improvements on all platforms.""", commit)
Cmd("git log -1 --format=%s rev1", "Log text 1.\n"),
Cmd("git log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"),
Cmd("git log -1 --format=%an rev1", "author1@chromium.org\n"),
+ ]
+ if not force:
+ expectations.append(Cmd("vi %s" % TEST_CONFIG[CHANGELOG_ENTRY_FILE], ""))
+ expectations += [
Cmd("git svn fetch", "fetch result\n"),
Cmd("git checkout -f svn/bleeding_edge", ""),
Cmd("git diff svn/trunk push_hash", "patch content\n"),
@@ -786,7 +781,8 @@ Performance and stability improvements on all platforms.""", commit)
Cmd("git checkout -f some_branch", ""),
Cmd("git branch -D %s" % TEST_CONFIG[BRANCHNAME], ""),
Cmd("git branch -D %s" % TEST_CONFIG[TRUNKBRANCH], ""),
- ])
+ ]
+ self.ExpectCmd(expectations)
# Expected keyboard input in manual mode:
if manual:
« 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