-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
75 lines (61 loc) · 1.8 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
import pytest
import os
@pytest.fixture(autouse=True)
def good_string_body():
name = "good_string_body.json"
with open(name, "w") as f:
f.write(
'{"string of text": {"prefix": "str", "body": "just a string", "description": "that\'s it"}}'
)
yield
os.remove(name)
@pytest.fixture(autouse=True)
def good_list_body():
name = "good_list_body.json"
with open(name, "w") as f:
f.write(
'{"list of stuff": {"prefix": "ls", "body": ["a line", "another line", "yet another line"], "description": "it\'s a list"}}'
)
yield
os.remove(name)
@pytest.fixture(autouse=True)
def error_no_name():
name = "error_no_name.json"
with open(name, "w") as f:
f.write(
'{{"prefix": "pre", "body": "valid body", "description": "valid description"}}'
)
yield
os.remove(name)
@pytest.fixture(autouse=True)
def warn_no_body():
name = "warn_no_body.json"
with open(name, "w") as f:
f.write('{"nothing": {"prefix": "nada", "description": "nothing to see here"}}')
yield
os.remove(name)
@pytest.fixture(autouse=True)
def warn_no_prefix():
name = "warn_no_prefix.json"
with open(name, "w") as f:
f.write('{"prefixless": {"body": "foobarbaz", "description": "whatever"}}')
yield
os.remove(name)
@pytest.fixture(autouse=True)
def warn_no_desc():
name = "warn_no_desc.json"
with open(name, "w") as f:
f.write('{"no description": {"prefix": "nod", "body": "no description"}}')
yield
os.remove(name)
@pytest.fixture
def json_files():
json_files = [
"good_string_body.json",
"good_list_body.json",
"error_no_name.json",
"warn_no_body.json",
"warn_no_prefix.json",
"warn_no_desc.json",
]
return json_files