Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork966
Expand file tree
/
Copy pathlib.py
More file actions
83 lines (60 loc) · 2.33 KB
/
lib.py
File metadata and controls
83 lines (60 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
"""Support library for performance tests."""
importlogging
importos
importos.pathasosp
importtempfile
fromgitimportRepo
fromgit.dbimportGitCmdObjectDB,GitDB
fromgit.utilimportrmtree
fromtest.libimportTestBase
# { Invariants
k_env_git_repo="GIT_PYTHON_TEST_GIT_REPO_BASE"
# } END invariants
# { Base Classes
classTestBigRepoR(TestBase):
"""TestCase providing access to readonly 'big' repositories using the following
member variables:
* gitrorepo:
Read-Only git repository - actually (by default) the repo of GitPython itself.
* puregitrorepo:
Like gitrorepo, but uses a pure Python implementation for its object database.
"""
defsetUp(self):
super().setUp()
repo_path=os.environ.get(k_env_git_repo)
ifrepo_pathisNone:
logging.info(
"You can set the %s environment variable to a .git repository of your"
" choice - defaulting to the GitPython repository",
k_env_git_repo,
)
repo_path=osp.dirname(__file__)
# END set some repo path
self.gitrorepo=Repo(repo_path,odbt=GitCmdObjectDB,search_parent_directories=True)
self.puregitrorepo=Repo(repo_path,odbt=GitDB,search_parent_directories=True)
deftearDown(self):
self.gitrorepo.git.clear_cache()
self.gitrorepo=None
self.puregitrorepo.git.clear_cache()
self.puregitrorepo=None
classTestBigRepoRW(TestBigRepoR):
"""Like :class:`TestBigRepoR`, but provides a big repository that we can write to.
Provides ``self.gitrwrepo`` and ``self.puregitrwrepo``.
"""
defsetUp(self):
self.gitrwrepo=None
super().setUp()
dirname=tempfile.mkdtemp()
self.gitrwrepo=self.gitrorepo.clone(dirname,shared=True,bare=True,odbt=GitCmdObjectDB)
self.puregitrwrepo=Repo(dirname,odbt=GitDB)
deftearDown(self):
super().tearDown()
ifself.gitrwrepoisnotNone:
rmtree(self.gitrwrepo.working_dir)
self.gitrwrepo.git.clear_cache()
self.gitrwrepo=None
self.puregitrwrepo.git.clear_cache()
self.puregitrwrepo=None
# } END base classes