-
-
Notifications
You must be signed in to change notification settings - Fork 396
/
Copy pathconftest.py
97 lines (69 loc) · 2.52 KB
/
conftest.py
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
from pathlib import Path
import platform
import pytest
import pygit2
from . import utils
@pytest.fixture(scope='session', autouse=True)
def global_git_config():
# Do not use global config for better test reproducibility.
# https://github.com/libgit2/pygit2/issues/989
levels = [
pygit2.enums.ConfigLevel.GLOBAL,
pygit2.enums.ConfigLevel.XDG,
pygit2.enums.ConfigLevel.SYSTEM,
]
for level in levels:
pygit2.settings.search_path[level] = ''
# Fix tests running in AppVeyor
if platform.system() == 'Windows':
pygit2.option(pygit2.enums.Option.SET_OWNER_VALIDATION, 0)
@pytest.fixture
def pygit2_empty_key():
path = Path(__file__).parent / 'keys' / 'pygit2_empty'
return path, f'{path}.pub', 'empty'
@pytest.fixture
def barerepo(tmp_path):
with utils.TemporaryRepository('barerepo.zip', tmp_path) as path:
yield pygit2.Repository(path)
@pytest.fixture
def barerepo_path(tmp_path):
with utils.TemporaryRepository('barerepo.zip', tmp_path) as path:
yield pygit2.Repository(path), path
@pytest.fixture
def blameflagsrepo(tmp_path):
with utils.TemporaryRepository('blameflagsrepo.zip', tmp_path) as path:
yield pygit2.Repository(path)
@pytest.fixture
def dirtyrepo(tmp_path):
with utils.TemporaryRepository('dirtyrepo.zip', tmp_path) as path:
yield pygit2.Repository(path)
@pytest.fixture
def emptyrepo(barerepo, tmp_path):
with utils.TemporaryRepository('emptyrepo.zip', tmp_path) as path:
repo = pygit2.Repository(path)
repo.remotes.create('origin', barerepo.path)
yield repo
@pytest.fixture
def encodingrepo(tmp_path):
with utils.TemporaryRepository('encoding.zip', tmp_path) as path:
yield pygit2.Repository(path)
@pytest.fixture
def mergerepo(tmp_path):
with utils.TemporaryRepository('testrepoformerging.zip', tmp_path) as path:
yield pygit2.Repository(path)
@pytest.fixture
def testrepo(tmp_path):
with utils.TemporaryRepository('testrepo.zip', tmp_path) as path:
yield pygit2.Repository(path)
@pytest.fixture
def testrepo_path(tmp_path):
with utils.TemporaryRepository('testrepo.zip', tmp_path) as path:
yield pygit2.Repository(path), path
@pytest.fixture
def testrepopacked(tmp_path):
with utils.TemporaryRepository('testrepopacked.zip', tmp_path) as path:
yield pygit2.Repository(path)
@pytest.fixture
def gpgsigned(tmp_path):
with utils.TemporaryRepository('gpgsigned.zip', tmp_path) as path:
yield pygit2.Repository(path)