forked from PrefectHQ/prefect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
32 lines (24 loc) · 834 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
26
27
28
29
30
31
32
import sys
import pytest
def pytest_addoption(parser):
parser.addoption(
"--skip-formatting",
action="store_true",
dest="formatting",
help="including this flag will skip all formatting tests",
)
def pytest_configure(config):
config.addinivalue_line(
"markers",
"formatting: mark test as formatting to skip when --skip-formatting flag is provided.",
)
def pytest_runtest_setup(item):
formatting_mark = item.get_closest_marker("formatting")
# if a test IS marked as "formatting" and the --skip-formatting flag IS set, skip it
if (
formatting_mark is not None
and item.config.getoption("--skip-formatting") is True
):
pytest.skip(
"Formatting tests skipped because --skip-formatting flag was provided."
)