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

Side by Side Diff: testing_support/fake_repos.py

Issue 743083002: Make gclient ready for the Blink (DEPS to main project) transition (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Fix tests Created 6 years 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 | « scm.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/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 """Generate fake repositories for testing.""" 6 """Generate fake repositories for testing."""
7 7
8 import atexit 8 import atexit
9 import datetime 9 import datetime
10 import errno 10 import errno
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 self._commit_git('repo_2', { 821 self._commit_git('repo_2', {
822 'DEPS': self.DEPS_git_pre % {'git_base': self.git_base}, 822 'DEPS': self.DEPS_git_pre % {'git_base': self.git_base},
823 'myfile': 'svn/trunk/src@1' 823 'myfile': 'svn/trunk/src@1'
824 }) 824 })
825 self._commit_git('repo_2', { 825 self._commit_git('repo_2', {
826 'DEPS': self.DEPS_post % {'git_base': self.git_base}, 826 'DEPS': self.DEPS_post % {'git_base': self.git_base},
827 'myfile': 'svn/trunk/src@2' 827 'myfile': 'svn/trunk/src@2'
828 }) 828 })
829 829
830 830
831 class FakeRepoBlinkDEPS(FakeReposBase):
832 """Simulates the Blink DEPS transition in Chrome."""
833
834 NB_GIT_REPOS = 2
835 DEPS_pre = 'deps = {"src/third_party/WebKit": "%(git_base)srepo_2",}'
836 DEPS_post = 'deps = {}'
837
838 def populateGit(self):
839 # Blink repo.
840 self._commit_git('repo_2', {
841 'OWNERS': 'OWNERS-pre',
842 'Source/exists_always': '_ignored_',
843 'Source/exists_before_but_not_after': '_ignored_',
844 })
845
846 # Chrome repo.
847 self._commit_git('repo_1', {
848 'DEPS': self.DEPS_pre % {'git_base': self.git_base},
849 'myfile': 'myfile@1',
850 '.gitignore': '/third_party/WebKit',
851 })
852 self._commit_git('repo_1', {
853 'DEPS': self.DEPS_post % {'git_base': self.git_base},
854 'myfile': 'myfile@2',
855 '.gitignore': '',
856 'third_party/WebKit/OWNERS': 'OWNERS-post',
857 'third_party/WebKit/Source/exists_always': '_ignored_',
858 'third_party/WebKit/Source/exists_after_but_not_before': '_ignored',
859 })
860
861 def populateSvn(self):
862 raise NotImplementedError()
863
864
831 class FakeReposTestBase(trial_dir.TestCase): 865 class FakeReposTestBase(trial_dir.TestCase):
832 """This is vaguely inspired by twisted.""" 866 """This is vaguely inspired by twisted."""
833 # Static FakeRepos instances. Lazy loaded. 867 # Static FakeRepos instances. Lazy loaded.
834 CACHED_FAKE_REPOS = {} 868 CACHED_FAKE_REPOS = {}
835 # Override if necessary. 869 # Override if necessary.
836 FAKE_REPOS_CLASS = FakeRepos 870 FAKE_REPOS_CLASS = FakeRepos
837 871
838 def setUp(self): 872 def setUp(self):
839 super(FakeReposTestBase, self).setUp() 873 super(FakeReposTestBase, self).setUp()
840 if not self.FAKE_REPOS_CLASS in self.CACHED_FAKE_REPOS: 874 if not self.FAKE_REPOS_CLASS in self.CACHED_FAKE_REPOS:
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 fake.set_up_git() 963 fake.set_up_git()
930 print('Fake setup, press enter to quit or Ctrl-C to keep the checkouts.') 964 print('Fake setup, press enter to quit or Ctrl-C to keep the checkouts.')
931 sys.stdin.readline() 965 sys.stdin.readline()
932 except KeyboardInterrupt: 966 except KeyboardInterrupt:
933 trial_dir.TrialDir.SHOULD_LEAK.leak = True 967 trial_dir.TrialDir.SHOULD_LEAK.leak = True
934 return 0 968 return 0
935 969
936 970
937 if __name__ == '__main__': 971 if __name__ == '__main__':
938 sys.exit(main(sys.argv)) 972 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « scm.py ('k') | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698