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

Unified Diff: tests/gclient_test.py

Issue 266043: Add pymox, fixed non-deterministic pprint.pformat output expectation.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 11 years, 2 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 | tests/pymox/COPYING » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/gclient_test.py
===================================================================
--- tests/gclient_test.py (revision 28591)
+++ tests/gclient_test.py (working copy)
@@ -31,6 +31,17 @@
from super_mox import mox
+class IsOneOf(mox.Comparator):
+ def __init__(self, keys):
+ self._keys = keys
+
+ def equals(self, rhs):
+ return rhs in self._keys
+
+ def __repr__(self):
+ return '<sequence or map containing \'%s\'>' % str(self._keys)
Mandeep Singh Baines 2009/10/09 22:28:35 An alternative might be to strip white-space and t
+
+
class BaseTestCase(super_mox.SuperMoxTestBase):
def setUp(self):
super_mox.SuperMoxTestBase.setUp(self)
@@ -393,10 +404,15 @@
"} ]\n"
) % (solution_name, self.url)
- entries_content = (
+ # pprint.pformat() is non-deterministic in this case!!
+ entries_content1 = (
"entries = \\\n"
"{ '%s': '%s'}\n"
) % (solution_name, self.url)
+ entries_content2 = (
+ "entries = \\\n"
+ "{'%s': '%s'}\n"
+ ) % (solution_name, self.url)
options = self.Options()
@@ -420,7 +436,7 @@
# After everything is done, an attempt is made to write an entries
# file.
gclient.FileWrite(os.path.join(self.root_dir, options.entries_filename),
- entries_content)
+ IsOneOf((entries_content1, entries_content2)))
self.mox.ReplayAll()
client = self._gclient_gclient(self.root_dir, options)
« no previous file with comments | « no previous file | tests/pymox/COPYING » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698