Markers#

Salt factories ships with a few markers, skip markers. Additional markers used in Salt’s test suite are provided by the skip-markers pytest plugin.

requires_salt_modules#

@pytest.mark.requires_salt_modules(*modules)#
Parameters:

modules (str) – Each argument passed to the marker should be a salt execution module that will need to be loaded by salt, or the test will be skipped. Allowed values are the module name, for example cmd, or the module name with the function name, cmd.run.

@pytest.mark.requires_salt_modules("cmd", "archive.tar")
def test_func():
    assert True

requires_salt_states#

@pytest.mark.requires_salt_states(*modules)#
Parameters:

modules (str) – Each argument passed to the marker should be a salt state module that will need to be loaded by salt, or the test will be skipped. Allowed values are the state module name, for example pkg, or the state module name with the function name, pkg.installed.

@pytest.mark.requires_salt_states("pkg", "archive.extracted")
def test_func():
    assert True

skip_on_salt_system_service#

@pytest.mark.skip_on_salt_system_service(reason=None)#
Parameters:

reason (str) – Custom skip reason. Defaults to “Test should not run against system install of Salt”.

@pytest.mark.skip_on_salt_system_service
def test_func():
    assert True