OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import atexit | 5 import atexit |
6 import collections | 6 import collections |
7 import copy | 7 import copy |
8 import datetime | 8 import datetime |
9 import hashlib | 9 import hashlib |
10 import os | 10 import os |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 """Makes new GitRepo. | 276 """Makes new GitRepo. |
277 | 277 |
278 Automatically creates a temp folder under GitRepo.BASE_TEMP_DIR. It's | 278 Automatically creates a temp folder under GitRepo.BASE_TEMP_DIR. It's |
279 recommended that you clean this repo up by calling nuke() on it, but if not, | 279 recommended that you clean this repo up by calling nuke() on it, but if not, |
280 GitRepo will automatically clean up all allocated repos at the exit of the | 280 GitRepo will automatically clean up all allocated repos at the exit of the |
281 program (assuming a normal exit like with sys.exit) | 281 program (assuming a normal exit like with sys.exit) |
282 | 282 |
283 Args: | 283 Args: |
284 schema - An instance of GitRepoSchema | 284 schema - An instance of GitRepoSchema |
285 """ | 285 """ |
286 self.repo_path = tempfile.mkdtemp(dir=self.BASE_TEMP_DIR) | 286 self.repo_path = os.path.realpath(tempfile.mkdtemp(dir=self.BASE_TEMP_DIR)) |
287 self.commit_map = {} | 287 self.commit_map = {} |
288 self._date = datetime.datetime(1970, 1, 1, tzinfo=UTC) | 288 self._date = datetime.datetime(1970, 1, 1, tzinfo=UTC) |
289 | 289 |
290 self.to_schema_refs = ['--branches'] | 290 self.to_schema_refs = ['--branches'] |
291 | 291 |
292 self.git('init') | 292 self.git('init') |
293 self.git('config', 'user.name', 'testcase') | 293 self.git('config', 'user.name', 'testcase') |
294 self.git('config', 'user.email', 'testcase@example.com') | 294 self.git('config', 'user.email', 'testcase@example.com') |
295 for commit in schema.walk(): | 295 for commit in schema.walk(): |
296 self._add_schema_commit(commit, schema.data_for(commit.name)) | 296 self._add_schema_commit(commit, schema.data_for(commit.name)) |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 super(GitRepoReadWriteTestBase, self).setUp() | 520 super(GitRepoReadWriteTestBase, self).setUp() |
521 self.repo = self.r_schema.reify() | 521 self.repo = self.r_schema.reify() |
522 | 522 |
523 def tearDown(self): | 523 def tearDown(self): |
524 self.repo.nuke() | 524 self.repo.nuke() |
525 super(GitRepoReadWriteTestBase, self).tearDown() | 525 super(GitRepoReadWriteTestBase, self).tearDown() |
526 | 526 |
527 def assertSchema(self, schema_string): | 527 def assertSchema(self, schema_string): |
528 self.assertEqual(GitRepoSchema(schema_string).simple_graph(), | 528 self.assertEqual(GitRepoSchema(schema_string).simple_graph(), |
529 self.repo.to_schema().simple_graph()) | 529 self.repo.to_schema().simple_graph()) |
OLD | NEW |