-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconftest.py
More file actions
26 lines (20 loc) · 746 Bytes
/
conftest.py
File metadata and controls
26 lines (20 loc) · 746 Bytes
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
import pytest
def pytest_addoption(parser: pytest.Parser):
parser.addoption(
"--pixiv-api",
action="store_true",
default=False,
help="Run tests that make Pixiv API calls.",
)
def pytest_configure(config: pytest.Config):
config.addinivalue_line(
"markers",
"pixiv_api: test performs Pixiv API calls and is skipped unless --pixiv-api is provided.",
)
def pytest_collection_modifyitems(config: pytest.Config, items: list[pytest.Item]):
if config.getoption("--pixiv-api"):
return
skip_pixiv_api = pytest.mark.skip(reason="need --pixiv-api option enabled")
for item in items:
if "pixiv_api" in item.keywords:
item.add_marker(skip_pixiv_api)