expand has/lacks_capability markers to support AND

This commit is contained in:
Lorow
2025-12-07 17:46:31 +01:00
parent 4dba0d5d70
commit d31c1ee502
2 changed files with 14 additions and 15 deletions
+11 -11
View File
@@ -37,10 +37,10 @@ def pytest_addoption(parser):
def pytest_configure(config): def pytest_configure(config):
config.addinivalue_line( config.addinivalue_line(
"markers", "has_capability(cap): skip if the board does not have the capability" "markers", "has_capability(caps): skip if the board does not have the capability"
) )
config.addinivalue_line( config.addinivalue_line(
"markers", "lacks_capability(cap): skip if the board DOES have the capability" "markers", "lacks_capability(caps): skip if the board DOES have the capability"
) )
@@ -60,9 +60,9 @@ def check_capability_marker(request, board_lacks_capability):
"has_capability marker must be provided with a capability to check" "has_capability marker must be provided with a capability to check"
) )
required_capability = marker.args[0] for capability in marker.args:
if board_lacks_capability(required_capability): if board_lacks_capability(capability):
pytest.skip(f"Board does not have capability {required_capability}") pytest.skip(f"Board does not have capability {capability}")
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@@ -72,12 +72,12 @@ def check_lacks_capability_marker(request, board_lacks_capability):
raise ValueError( raise ValueError(
"lacks_capability marker must be provided with a capability to check" "lacks_capability marker must be provided with a capability to check"
) )
required_capability = lacks_capability_marker.args[0] for capability in lacks_capability_marker.args:
if not board_lacks_capability(required_capability): if not board_lacks_capability(capability):
pytest.skip( pytest.skip(
"The board supports given capability: {required_capability}, skipping" "The board supports given capability: {required_capability}, skipping"
) )
@pytest.fixture(scope="session", autouse=True) @pytest.fixture(scope="session", autouse=True)
+3 -4
View File
@@ -22,8 +22,7 @@ def test_ping_wired(get_openiris_device):
assert not has_command_failed(command_result) assert not has_command_failed(command_result)
@pytest.mark.has_capability("wired") @pytest.mark.has_capability("wired", "wireless")
@pytest.mark.has_capability("wireless")
def test_changing_mode_to_wired(get_openiris_device, ensure_board_in_mode, config): def test_changing_mode_to_wired(get_openiris_device, ensure_board_in_mode, config):
device = get_openiris_device() device = get_openiris_device()
@@ -93,8 +92,8 @@ def test_setting_mdns_name_invalid_payload(get_openiris_device, payload):
assert has_command_failed(command_result) assert has_command_failed(command_result)
@pytest.mark.has_capability("wired") @pytest.mark.has_capability("wired", "wireless")
@pytest.mark.has_capability("wireless") # make this to be has_capabilities instead
def test_reboot_command(get_openiris_device, ensure_board_in_mode, config): def test_reboot_command(get_openiris_device, ensure_board_in_mode, config):
device = ensure_board_in_mode("wifi", get_openiris_device()) device = ensure_board_in_mode("wifi", get_openiris_device())