#!/usr/bin/python3 import pytest def pytest_addoption(parser): parser.addoption( "--manual", action="store_true", help="Run tests that need a human for verification.") def pytest_collection_modifyitems(config, items): if config.getoption('--manual'): skip_normal = pytest.mark.skip(reason=f"Only manual tests get run when --manual is set.") for item in items: if not "manual" in item.keywords: item.add_marker(skip_normal) else: skip_manual = pytest.mark.skip(reason=f"Only normal tests get run when --manual is not set.") for item in items: if "manual" in item.keywords: item.add_marker(skip_manual)