Skip to content

Commit 96f201b

Browse files
Concatenate strings that are separated by a single space
1 parent e1eb9c1 commit 96f201b

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

test/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ def setup_ansible_config(tmpdir, name, host, user, port, key):
6969
"ansible_user={}".format(user),
7070
"ansible_port={}".format(port),
7171
]
72-
tmpdir.join("inventory").write("[testgroup]\n" + " ".join(items) + "\n")
72+
tmpdir.join("inventory").write(f'[testgroup]\n{" ".join(items)}\n')
7373
tmpdir.mkdir("host_vars").join(name).write(ANSIBLE_HOSTVARS)
7474
tmpdir.mkdir("group_vars").join("testgroup").write(
75-
("---\n" "myhostvar: should_be_overriden\n" "mygroupvar: qux\n")
75+
"---\nmyhostvar: should_be_overriden\nmygroupvar: qux\n"
7676
)
7777
vault_password_file = tmpdir.join("vault-pass.txt")
7878
vault_password_file.write("polichinelle\n")

test/test_backends.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,18 @@ def test_encoding(host):
8686
elif host.backend.get_connection_type() == "ansible" and host.backend.force_ansible:
8787
# XXX: this encoding issue comes directly from ansible
8888
# not sure how to handle this...
89-
assert cmd.stderr == (
90-
"ls: impossible d'accéder à '/é': " "Aucun fichier ou dossier de ce type"
89+
assert (
90+
cmd.stderr
91+
== "ls: impossible d'accéder à '/é': Aucun fichier ou dossier de ce type"
9192
)
9293
else:
9394
assert cmd.stderr_bytes == (
9495
b"ls: impossible d'acc\xe9der \xe0 '/\xe9': "
9596
b"Aucun fichier ou dossier de ce type\n"
9697
)
97-
assert cmd.stderr == (
98-
"ls: impossible d'accéder à '/é': " "Aucun fichier ou dossier de ce type\n"
98+
assert (
99+
cmd.stderr
100+
== "ls: impossible d'accéder à '/é': Aucun fichier ou dossier de ce type\n"
99101
)
100102

101103

test/test_modules.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def test_file(host):
329329

330330

331331
def test_ansible_unavailable(host):
332-
expected = "Ansible module is only available with " "ansible connection backend"
332+
expected = "Ansible module is only available with ansible connection backend"
333333
with pytest.raises(RuntimeError) as excinfo:
334334
host.ansible("setup")
335335
assert expected in str(excinfo.value)
@@ -374,7 +374,7 @@ def test_ansible_module(host):
374374
except host.ansible.AnsibleException as exc:
375375
assert exc.result["rc"] == 2
376376
# notez que the debian bookworm container is set to LANG=fr_FR
377-
assert exc.result["msg"] == ("[Errno 2] Aucun fichier ou dossier " "de ce type")
377+
assert exc.result["msg"] == "[Errno 2] Aucun fichier ou dossier de ce type"
378378

379379
result = host.ansible("command", "echo foo", check=False)
380380
assert result["stdout"] == "foo"

testinfra/backend/lxc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, name: str, *args: Any, **kwargs: Any):
2525
def run(self, command: str, *args: str, **kwargs: Any) -> base.CommandResult:
2626
cmd = self.get_command(command, *args)
2727
out = self.run_local(
28-
"lxc exec %s --mode=non-interactive -- " "/bin/sh -c %s", self.name, cmd
28+
"lxc exec %s --mode=non-interactive -- /bin/sh -c %s", self.name, cmd
2929
)
3030
out.command = self.encode(cmd)
3131
return out

testinfra/modules/ansible.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def need_ansible(func):
3838
def wrapper(self, *args, **kwargs):
3939
if not self._host.backend.HAS_RUN_ANSIBLE:
4040
raise RuntimeError(
41-
("Ansible module is only available with ansible " "connection backend")
41+
("Ansible module is only available with ansible connection backend")
4242
)
4343
return func(self, *args, **kwargs)
4444

testinfra/modules/mountpoint.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ def get_module_class(cls, host):
101101
raise NotImplementedError
102102

103103
def __repr__(self):
104-
return (
105-
"<MountPoint(path={}, device={}, filesystem={}, " "options={})>"
106-
).format(
104+
return ("<MountPoint(path={}, device={}, filesystem={}, options={})>").format(
107105
self.path,
108106
self.device,
109107
self.filesystem,

testinfra/modules/puppet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class Facter(InstanceModule):
102102
"""
103103

104104
def __call__(self, *facts):
105-
cmd = "facter --json --puppet " + " ".join(facts)
105+
cmd = f'facter --json --puppet {" ".join(facts)}'
106106
return json.loads(self.check_output(cmd))
107107

108108
def __repr__(self):

0 commit comments

Comments
 (0)