Verified Commit cebecdc2 authored by Karel Koci's avatar Karel Koci 🤘
Browse files

tests: add not_board mark

This is negation of board mark. This should help us to limit tests not
only to explicit list of boards but also do exclusion list.

The immediate usage of this is in DNS resolver processes check.
parent 5909ade1
......@@ -5,6 +5,7 @@ log_format = %(levelname)s[%(relativeCreated)d]%(name)s %(message)s
log_cli_format = %(levelname)s %(name)s %(message)s
markers =
deploy: quick tests to be run as part of deployment process
board(boards): mark test to run only on specified board
board(boards): mark test to run only on specified boards
not_board(boards): mark test to not run on specified boards
lan1: requirement of lan1 ethernet connection to board
lan2: requirement of lan2 ethernet connection to board
......@@ -64,10 +64,15 @@ def pytest_sessionstart(session):
def pytest_runtest_setup(item):
board = item.config.target_config.board
for boards in item.iter_markers(name="board"):
if board not in boards.args:
def check_board(boards, expected):
board = item.config.target_config.board
if (board in boards.args) is expected:
pytest.skip(f"test is not compatible with target: {board}")
for boards in item.iter_markers(name="board"):
check_board(boards, False)
for boards in item.iter_markers(name="not_board"):
check_board(boards, True)
for conn in ("lan1", "lan2"):
if item.get_closest_marker(conn) is not None and not item.config.target_config.is_configured(conn):
pytest.skip(f"test requires connection: {conn}")
......
......@@ -14,7 +14,8 @@ def test_syslog_ng(client_board):
@pytest.mark.parametrize("process", [
"crond",
"dnsmasq",
"kresd",
pytest.param("kresd", marks=pytest.mark.not_board("turris1x")),
pytest.param("unbound", marks=pytest.mark.board("turris1x")),
"lighttpd",
"mosquitto",
"netifd",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment