Fix state.test test, run pre-commit

The test fix was part of 6a715107fa
This commit is contained in:
jeanluc 2024-06-24 09:02:26 +02:00 committed by Daniel Wozniak
parent db1dfb6784
commit 8e54f28333
4 changed files with 8 additions and 7 deletions

View file

@ -173,7 +173,7 @@ def renderer(path=None, string=None, default_renderer="jinja|yaml", **kwargs):
default_renderer,
__opts__["renderer_blacklist"],
__opts__["renderer_whitelist"],
**kwargs
**kwargs,
)
return ret.read() if salt.utils.stringio.is_readable(ret) else ret
@ -185,12 +185,12 @@ def _get_serialize_fn(serializer, fn_name):
if not fns:
raise salt.exceptions.CommandExecutionError(
"Serializer '{}' not found.".format(serializer)
f"Serializer '{serializer}' not found."
)
if not fn:
raise salt.exceptions.CommandExecutionError(
"Serializer '{}' does not implement {}.".format(serializer, fn_name)
f"Serializer '{serializer}' does not implement {fn_name}."
)
return fn
@ -419,7 +419,7 @@ def findup(startpath, filenames, saltenv="base"):
# Verify the cwd is a valid path in the state tree
if startpath and not path_exists(startpath, saltenv):
raise salt.exceptions.SaltInvocationError(
"Starting path not found in the state tree: {}".format(startpath)
f"Starting path not found in the state tree: {startpath}"
)
# Ensure that patterns is a string or list of strings

View file

@ -17,7 +17,7 @@ def state_tree(base_env_state_tree_root_dir):
state_file = """
{%- from "map.jinja" import abc with context %}
Ok with {{ abc }}:
test.succeed_without_changes
test.succeed_with_changes
"""
top_tempfile = pytest.helpers.temp_file(
"top.sls", top_file, base_env_state_tree_root_dir

View file

@ -16,7 +16,9 @@ def test_items(salt_ssh_cli):
@pytest.mark.parametrize("omit", (False, True))
def test_option_minion_opt(salt_ssh_cli, omit):
# Minion opt
ret = salt_ssh_cli.run("config.option", "id", omit_opts=omit, omit_grains=True)
ret = salt_ssh_cli.run(
"config.option", "id", omit_opts=omit, omit_grains=True, omit_master=True
)
assert ret.returncode == 0
assert (ret.data != salt_ssh_cli.get_minion_tgt()) is omit
assert (ret.data == "") is omit

View file

@ -3,7 +3,6 @@
This tests the SSH wrapper module.
"""
import fnmatch
import pytest