-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconftest.py
41 lines (31 loc) · 1.36 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
import json
import pathlib
import fastjsonschema
import pytest
@pytest.fixture(scope="session")
def paths():
"""Sets the paths of where to find inputs, generated outputs, and expected outputs.
Returns:
Nothing, it's a fixture that is run before every test.
"""
return {
"inputDest": pathlib.Path("tests/test_question_templates/question_inputs/"),
"outputDest": pathlib.Path("tests/test_question_templates/question_generated_outputs/"),
"compareDest": pathlib.Path("tests/test_question_templates/question_expected_outputs/"),
"returnCompareDest": pathlib.Path("tests/test_question_templates/question_return_expected_outputs/"),
"returnOutputDest": pathlib.Path("tests/test_question_templates/question_return_generated_outputs/"),
}
@pytest.fixture(scope="session")
def validate_info_json():
"""Generates a schema validator for info.json files.
Returns:
Nothing, it's a fixture that is run before every test.
"""
with open("tests/infoSchema.json") as file:
return fastjsonschema.compile(json.load(file))
@pytest.fixture(scope="session", autouse=True)
def monkeypatch_prairielearn():
"""Monkeypatches the prairielearn module into sys.modules to make it accessible."""
import sys
from problem_bank_scripts import prairielearn
sys.modules["prairielearn"] = prairielearn