OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 """Unit tests for git_freezer.py""" | 6 """Unit tests for git_freezer.py""" |
7 | 7 |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 | 10 |
11 DEPOT_TOOLS_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | 11 DEPOT_TOOLS_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
12 sys.path.insert(0, DEPOT_TOOLS_ROOT) | 12 sys.path.insert(0, DEPOT_TOOLS_ROOT) |
13 | 13 |
14 from testing_support import coverage_utils | 14 from testing_support import coverage_utils |
15 from testing_support import git_test_utils | 15 from testing_support import git_test_utils |
16 | 16 |
17 | 17 |
18 class GitFreezeThaw(git_test_utils.GitRepoReadWriteTestBase): | 18 class GitFreezeThaw(git_test_utils.GitRepoReadWriteTestBase): |
19 @classmethod | 19 @classmethod |
20 def setUpClass(cls): | 20 def setUpClass(cls): |
21 super(GitFreezeThaw, cls).setUpClass() | 21 super(GitFreezeThaw, cls).setUpClass() |
22 import git_freezer | 22 import git_freezer |
23 cls.gf = git_freezer | 23 cls.gf = git_freezer |
24 | 24 |
25 REPO = """ | 25 REPO_SCHEMA = """ |
26 A B C D | 26 A B C D |
27 B E D | 27 B E D |
28 """ | 28 """ |
29 | 29 |
30 COMMIT_A = { | 30 COMMIT_A = { |
31 'some/files/file1': {'data': 'file1'}, | 31 'some/files/file1': {'data': 'file1'}, |
32 'some/files/file2': {'data': 'file2'}, | 32 'some/files/file2': {'data': 'file2'}, |
33 'some/files/file3': {'data': 'file3'}, | 33 'some/files/file3': {'data': 'file3'}, |
34 'some/other/file': {'data': 'otherfile'}, | 34 'some/other/file': {'data': 'otherfile'}, |
35 } | 35 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 self.assertEquals(self.repo.git('status', '--porcelain').stdout, STATUS_1) | 90 self.assertEquals(self.repo.git('status', '--porcelain').stdout, STATUS_1) |
91 | 91 |
92 self.repo.run(inner) | 92 self.repo.run(inner) |
93 | 93 |
94 | 94 |
95 | 95 |
96 if __name__ == '__main__': | 96 if __name__ == '__main__': |
97 sys.exit(coverage_utils.covered_main( | 97 sys.exit(coverage_utils.covered_main( |
98 os.path.join(DEPOT_TOOLS_ROOT, 'git_freezer.py') | 98 os.path.join(DEPOT_TOOLS_ROOT, 'git_freezer.py') |
99 )) | 99 )) |
OLD | NEW |