forked from hsahovic/poke-env
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
47 lines (33 loc) · 1.09 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
import os
import orjson
from pytest import fixture
FIXTURE_DIR = os.path.join("fixture_data")
@fixture
def showdown_format_teams(raw_team_data):
data = {}
for format_, team_list in raw_team_data.items():
data[format_] = []
for team_info in team_list:
with open(os.path.join(FIXTURE_DIR, team_info["showdown-file"])) as f:
data[format_].append(f.read())
return data
@fixture
def packed_format_teams(raw_team_data):
data = {}
for format_, team_list in raw_team_data.items():
data[format_] = []
for team_info in team_list:
data[format_].append(team_info["packed-format"])
return data
@fixture
def raw_team_data():
with open(os.path.join(FIXTURE_DIR, "teams.json")) as f:
return orjson.loads(f.read())
@fixture
def example_request():
with open(os.path.join(FIXTURE_DIR, "example_request.json")) as f:
return orjson.loads(f.read())
@fixture
def example_doubles_request():
with open(os.path.join(FIXTURE_DIR, "example_doubles_request.json")) as f:
return orjson.loads(f.read())