forked from mantidproject/mantidimaging
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
33 lines (22 loc) · 1.08 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
# Copyright (C) 2023 ISIS Rutherford Appleton Laboratory UKRI
# SPDX - License - Identifier: GPL-3.0-or-later
from __future__ import annotations
import pytest
def _test_gui_system_filename_match(basename: str) -> bool:
return "gui_system" in basename and "_test.py" in basename
def pytest_addoption(parser):
parser.addoption("--run-system-tests", action="store_true", default=False, help="Run GUI system tests")
def pytest_configure(config):
config.addinivalue_line("markers", "system: GUI system tests")
def pytest_ignore_collect(path, config):
# When running GUI system tests, ignore all other files
if config.getoption("--run-system-tests") and path.isfile() and not _test_gui_system_filename_match(path.basename):
return True
else:
return False
def pytest_collection_modifyitems(config, items):
if not config.getoption("--run-system-tests"):
skip_system = pytest.mark.skip(reason="use --run-system-tests option to run")
for item in items:
if "system" in item.keywords:
item.add_marker(skip_system)