-
Notifications
You must be signed in to change notification settings - Fork 6
/
conftest.py
25 lines (20 loc) · 906 Bytes
/
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
from _pytest.config.argparsing import Parser
from _pytest.python import Metafunc
from notifier.config.local import read_local_auth, read_local_config
from tests.test_database import sample_database
def pytest_addoption(parser: Parser) -> None:
parser.addoption("--notifier-config", type=str, required=True)
parser.addoption("--notifier-auth", type=str, required=True)
def pytest_generate_tests(metafunc: Metafunc) -> None:
if (
config := metafunc.config.getoption("notifier_config")
) and "notifier_config" in metafunc.fixturenames:
metafunc.parametrize(
"notifier_config", [read_local_config(config)], scope="module"
)
if (
auth := metafunc.config.getoption("notifier_auth")
) and "notifier_auth" in metafunc.fixturenames:
metafunc.parametrize(
"notifier_auth", [read_local_auth(auth)], scope="module"
)