| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 """Generate fake repositories for testing.""" | 6 """Generate fake repositories for testing.""" |
| 7 | 7 |
| 8 import atexit | 8 import atexit |
| 9 import errno | 9 import errno |
| 10 import logging | 10 import logging |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 # Strip the begining | 589 # Strip the begining |
| 590 while expected and result and expected[0] == result[0]: | 590 while expected and result and expected[0] == result[0]: |
| 591 expected = expected[1:] | 591 expected = expected[1:] |
| 592 result = result[1:] | 592 result = result[1:] |
| 593 # The exception trace makes it hard to read so dump it too. | 593 # The exception trace makes it hard to read so dump it too. |
| 594 if '\n' in result: | 594 if '\n' in result: |
| 595 print result | 595 print result |
| 596 self.assertEquals(expected, result, msg) | 596 self.assertEquals(expected, result, msg) |
| 597 | 597 |
| 598 def check(self, expected, results): | 598 def check(self, expected, results): |
| 599 """Checks stdout, stderr, retcode.""" | 599 """Checks stdout, stderr, returncode.""" |
| 600 self.checkString(expected[0], results[0]) | 600 self.checkString(expected[0], results[0]) |
| 601 self.checkString(expected[1], results[1]) | 601 self.checkString(expected[1], results[1]) |
| 602 self.assertEquals(expected[2], results[2]) | 602 self.assertEquals(expected[2], results[2]) |
| 603 | 603 |
| 604 def assertTree(self, tree, tree_root=None): | 604 def assertTree(self, tree, tree_root=None): |
| 605 """Diff the checkout tree with a dict.""" | 605 """Diff the checkout tree with a dict.""" |
| 606 if not tree_root: | 606 if not tree_root: |
| 607 tree_root = self.root_dir | 607 tree_root = self.root_dir |
| 608 actual = read_tree(tree_root) | 608 actual = read_tree(tree_root) |
| 609 diff = dict_diff(tree, actual) | 609 diff = dict_diff(tree, actual) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 | 662 |
| 663 | 663 |
| 664 # Kind of hack. | 664 # Kind of hack. |
| 665 if '-l' in sys.argv: | 665 if '-l' in sys.argv: |
| 666 FakeRepos.SHOULD_LEAK = True | 666 FakeRepos.SHOULD_LEAK = True |
| 667 sys.argv.remove('-l') | 667 sys.argv.remove('-l') |
| 668 | 668 |
| 669 | 669 |
| 670 if __name__ == '__main__': | 670 if __name__ == '__main__': |
| 671 sys.exit(main(sys.argv)) | 671 sys.exit(main(sys.argv)) |
| OLD | NEW |