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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 """Generate both svn and git repositories to test gclient functionality. | 201 """Generate both svn and git repositories to test gclient functionality. |
202 | 202 |
203 Many DEPS functionalities need to be tested: Var, File, From, deps_os, hooks, | 203 Many DEPS functionalities need to be tested: Var, File, From, deps_os, hooks, |
204 use_relative_paths. | 204 use_relative_paths. |
205 | 205 |
206 And types of dependencies: Relative urls, Full urls, both svn and git. | 206 And types of dependencies: Relative urls, Full urls, both svn and git. |
207 | 207 |
208 populateSvn() and populateGit() need to be implemented by the subclass. | 208 populateSvn() and populateGit() need to be implemented by the subclass. |
209 """ | 209 """ |
210 | 210 |
211 # Should leak the repositories. | 211 # When SHOULD_LEAK is set to True, temporary directories created while the |
| 212 # tests are running aren't deleted at the end of the tests. Expect failures |
| 213 # when running more than one test due to inter-test side-effects. Helps with |
| 214 # debugging. |
212 SHOULD_LEAK = False | 215 SHOULD_LEAK = False |
213 # Override if unhappy. | 216 # Override if unhappy. |
214 TRIAL_DIR = None | 217 TRIAL_DIR = None |
215 # Hostname | 218 # Hostname |
216 HOST = '127.0.0.1' | 219 HOST = '127.0.0.1' |
217 NB_GIT_REPOS = 1 | 220 NB_GIT_REPOS = 1 |
218 USERS = [ | 221 USERS = [ |
219 ('user1@example.com', 'foo'), | 222 ('user1@example.com', 'foo'), |
220 ('user2@example.com', 'bar'), | 223 ('user2@example.com', 'bar'), |
221 ] | 224 ] |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 print 'Using %s' % fake.trial_dir() | 721 print 'Using %s' % fake.trial_dir() |
719 try: | 722 try: |
720 fake.setUp() | 723 fake.setUp() |
721 print('Fake setup, press enter to quit or Ctrl-C to keep the checkouts.') | 724 print('Fake setup, press enter to quit or Ctrl-C to keep the checkouts.') |
722 sys.stdin.readline() | 725 sys.stdin.readline() |
723 except KeyboardInterrupt: | 726 except KeyboardInterrupt: |
724 fake.SHOULD_LEAK = True | 727 fake.SHOULD_LEAK = True |
725 return 0 | 728 return 0 |
726 | 729 |
727 | 730 |
728 # Kind of hack. | |
729 if '-l' in sys.argv: | 731 if '-l' in sys.argv: |
| 732 # See SHOULD_LEAK definition in FakeReposBase for its purpose. |
730 FakeReposBase.SHOULD_LEAK = True | 733 FakeReposBase.SHOULD_LEAK = True |
731 print 'Leaking!' | 734 print 'Leaking!' |
732 sys.argv.remove('-l') | 735 sys.argv.remove('-l') |
733 | 736 |
734 | 737 |
735 if __name__ == '__main__': | 738 if __name__ == '__main__': |
736 sys.exit(main(sys.argv)) | 739 sys.exit(main(sys.argv)) |
OLD | NEW |