Chromium Code Reviews| 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) |