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

Side by Side Diff: tests/fake_repos.py

Issue 2285003: Add more smoke test for gclient config and gclient revinfo. (Closed)
Patch Set: Created 10 years, 7 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
« no previous file with comments | « gclient.py ('k') | tests/gclient_smoketest.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 logging 8 import logging
9 import os 9 import os
10 import re 10 import re
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 rev = re.search(r'revision (\d+).', out).group(1) 82 rev = re.search(r'revision (\d+).', out).group(1)
83 st = Popen(['svn', 'status'], cwd=repo).communicate()[0] 83 st = Popen(['svn', 'status'], cwd=repo).communicate()[0]
84 assert len(st) == 0, st 84 assert len(st) == 0, st
85 logging.debug('At revision %s' % rev) 85 logging.debug('At revision %s' % rev)
86 return rev 86 return rev
87 87
88 88
89 def commit_git(repo): 89 def commit_git(repo):
90 """Commits the changes and returns the new hash.""" 90 """Commits the changes and returns the new hash."""
91 check_call(['git', 'add', '-A', '-f'], cwd=repo) 91 check_call(['git', 'add', '-A', '-f'], cwd=repo)
92 out = Popen(['git', 'commit', '-m', 'foo'], cwd=repo).communicate()[0] 92 check_call(['git', 'commit', '-q', '--message', 'foo'], cwd=repo)
93 rev = re.search(r'^\[.*? ([a-f\d]+)\] ', out).group(1) 93 rev = Popen(['git', 'show-ref', '--head', 'HEAD'],
94 cwd=repo).communicate()[0].split(' ', 1)[0]
94 logging.debug('At revision %s' % rev) 95 logging.debug('At revision %s' % rev)
95 return rev 96 return rev
96 97
97 98
98 class FakeRepos(object): 99 class FakeRepos(object):
99 """Generate both svn and git repositories to test gclient functionality. 100 """Generate both svn and git repositories to test gclient functionality.
100 101
101 Many DEPS functionalities need to be tested: Var, File, From, deps_os, hooks, 102 Many DEPS functionalities need to be tested: Var, File, From, deps_os, hooks,
102 use_relative_paths. 103 use_relative_paths.
103 104
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 sys.stdin.readline() 384 sys.stdin.readline()
384 except KeyboardInterrupt: 385 except KeyboardInterrupt:
385 fake.leak = True 386 fake.leak = True
386 finally: 387 finally:
387 fake.tearDown() 388 fake.tearDown()
388 return 0 389 return 0
389 390
390 391
391 if __name__ == '__main__': 392 if __name__ == '__main__':
392 sys.exit(main(sys.argv)) 393 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « gclient.py ('k') | tests/gclient_smoketest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698