-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconftest.py
More file actions
67 lines (49 loc) · 1.29 KB
/
conftest.py
File metadata and controls
67 lines (49 loc) · 1.29 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
from utils import Process
import os
import pytest
@pytest.fixture
def tempdir(tmp_path):
cwd = os.getcwd()
try:
wd = tmp_path / "testdir"
wd.mkdir()
yield wd
finally:
os.chdir(cwd)
@pytest.fixture
def src(tempdir):
base = tempdir / "src"
os.mkdir(base)
return base
@pytest.fixture
def mkgitrepo(tempdir):
from utils import GitRepo
def _mkgitrepo(name):
repository = GitRepo(tempdir / name)
repository.init()
repository.setup_user()
return repository
return _mkgitrepo
@pytest.fixture
def git_allow_file_protocol():
"""Allow file protocol
This is needed for the submodule to be added from a local path
"""
shell = Process()
file_allow = shell.check_call("git config --global --get protocol.file.allow")[0].decode("utf8").strip()
shell.check_call("git config --global protocol.file.allow always")
yield file_allow
shell.check_call(f"git config --global protocol.file.allow {file_allow}")
@pytest.fixture
def develop(src):
from utils import MockDevelop
develop = MockDevelop()
develop.sources_dir = src
return develop
@pytest.fixture
def httpretty():
import httpretty
httpretty.enable()
yield httpretty
httpretty.disable()
httpretty.reset()