OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Unit tests for gclient.py. | 6 """Unit tests for gclient.py. |
7 | 7 |
8 See gclient_smoketest.py for integration tests. | 8 See gclient_smoketest.py for integration tests. |
9 """ | 9 """ |
10 | 10 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 self._check_requirements( | 182 self._check_requirements( |
183 obj, | 183 obj, |
184 { | 184 { |
185 'foo': [], | 185 'foo': [], |
186 'bar': [], | 186 'bar': [], |
187 'bar/empty': ['bar'], | 187 'bar/empty': ['bar'], |
188 }) | 188 }) |
189 | 189 |
190 def _check_requirements(self, solution, expected): | 190 def _check_requirements(self, solution, expected): |
191 for dependency in solution.dependencies: | 191 for dependency in solution.dependencies: |
192 self.assertEquals( | 192 e = expected.pop(dependency.name) |
193 expected.pop(dependency.name), sorted(dependency.requirements)) | 193 a = sorted(dependency.requirements) |
| 194 self.assertEquals(e, a, (dependency.name, e, a)) |
194 self.assertEquals({}, expected) | 195 self.assertEquals({}, expected) |
195 | 196 |
196 def _get_processed(self): | 197 def _get_processed(self): |
197 """Retrieves the item in the order they were processed.""" | 198 """Retrieves the item in the order they were processed.""" |
198 items = [] | 199 items = [] |
199 try: | 200 try: |
200 while True: | 201 while True: |
201 items.append(self.processed.get_nowait()) | 202 items.append(self.processed.get_nowait()) |
202 except Queue.Empty: | 203 except Queue.Empty: |
203 pass | 204 pass |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) | 250 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) |
250 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) | 251 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) |
251 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr) | 252 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr) |
252 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True) | 253 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True) |
253 logging.basicConfig( | 254 logging.basicConfig( |
254 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ | 255 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ |
255 min(sys.argv.count('-v'), 3)], | 256 min(sys.argv.count('-v'), 3)], |
256 format='%(relativeCreated)4d %(levelname)5s %(module)13s(' | 257 format='%(relativeCreated)4d %(levelname)5s %(module)13s(' |
257 '%(lineno)d) %(message)s') | 258 '%(lineno)d) %(message)s') |
258 unittest.main() | 259 unittest.main() |
OLD | NEW |