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

Side by Side Diff: tests/fake_repos.py

Issue 3333028: Improve the testing situation on Windows.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 10 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « presubmit_support.py ('k') | tests/gclient_scm_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 if not os.path.isdir(p): 279 if not os.path.isdir(p):
280 os.makedirs(p) 280 os.makedirs(p)
281 if v is None: 281 if v is None:
282 os.remove(join(root, k)) 282 os.remove(join(root, k))
283 else: 283 else:
284 write(join(root, k), v) 284 write(join(root, k), v)
285 285
286 def setUpSVN(self): 286 def setUpSVN(self):
287 """Creates subversion repositories and start the servers.""" 287 """Creates subversion repositories and start the servers."""
288 if self.svnserve: 288 if self.svnserve:
289 return 289 return True
290 self.setUp() 290 self.setUp()
291 root = join(self.repos_dir, 'svn') 291 root = join(self.repos_dir, 'svn')
292 check_call(['svnadmin', 'create', root]) 292 try:
293 check_call(['svnadmin', 'create', root])
294 except OSError:
295 self.svn_enabled = False
296 return False
293 write(join(root, 'conf', 'svnserve.conf'), 297 write(join(root, 'conf', 'svnserve.conf'),
294 '[general]\n' 298 '[general]\n'
295 'anon-access = read\n' 299 'anon-access = read\n'
296 'auth-access = write\n' 300 'auth-access = write\n'
297 'password-db = passwd\n') 301 'password-db = passwd\n')
298 write(join(root, 'conf', 'passwd'), 302 write(join(root, 'conf', 'passwd'),
299 '[users]\n' 303 '[users]\n'
300 'user1 = foo\n' 304 'user1 = foo\n'
301 'user2 = bar\n') 305 'user2 = bar\n')
302 306
303 # Start the daemon. 307 # Start the daemon.
304 cmd = ['svnserve', '-d', '--foreground', '-r', self.repos_dir] 308 cmd = ['svnserve', '-d', '--foreground', '-r', self.repos_dir]
305 if self.HOST == '127.0.0.1': 309 if self.HOST == '127.0.0.1':
306 cmd.append('--listen-host=127.0.0.1') 310 cmd.append('--listen-host=127.0.0.1')
307 self.svnserve = Popen(cmd, cwd=root) 311 self.svnserve = Popen(cmd, cwd=root)
308 self.populateSvn() 312 self.populateSvn()
313 return True
309 314
310 def populateSvn(self): 315 def populateSvn(self):
311 """Creates a few revisions of changes including DEPS files.""" 316 """Creates a few revisions of changes including DEPS files."""
312 # Repos 317 # Repos
313 check_call(['svn', 'checkout', 'svn://127.0.0.1/svn', self.svn_root, '-q', 318 check_call(['svn', 'checkout', 'svn://127.0.0.1/svn', self.svn_root, '-q',
314 '--non-interactive', '--no-auth-cache', 319 '--non-interactive', '--no-auth-cache',
315 '--username', 'user1', '--password', 'foo']) 320 '--username', 'user1', '--password', 'foo'])
316 assert os.path.isdir(join(self.svn_root, '.svn')) 321 assert os.path.isdir(join(self.svn_root, '.svn'))
317 def file_system(rev, DEPS): 322 def file_system(rev, DEPS):
318 fs = { 323 fs = {
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 667
663 668
664 # Kind of hack. 669 # Kind of hack.
665 if '-l' in sys.argv: 670 if '-l' in sys.argv:
666 FakeRepos.SHOULD_LEAK = True 671 FakeRepos.SHOULD_LEAK = True
667 sys.argv.remove('-l') 672 sys.argv.remove('-l')
668 673
669 674
670 if __name__ == '__main__': 675 if __name__ == '__main__':
671 sys.exit(main(sys.argv)) 676 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « presubmit_support.py ('k') | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698