Skip to content

Commit 94d54e1

Browse files
committed
Update test_exec_command to test repeated calls to ensure the object remains usable
1 parent 66065cd commit 94d54e1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/unit/channel_test.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,14 @@ def ssh_channel(ssh_client_session):
3232
'Ref: https://github.com/ansible/pylibssh/issues/57', # noqa: WPS326
3333
strict=False,
3434
)
35-
@pytest.mark.forked() # noqa: PT023 -- it's unclear if braces are needed here
35+
@pytest.mark.forked
3636
def test_exec_command(ssh_channel):
3737
"""Test getting the output of a remotely executed command."""
3838
u_cmd_out = ssh_channel.exec_command('echo -n Hello World').stdout.decode()
3939
assert u_cmd_out == u'Hello World' # noqa: WPS302
40+
# Test that repeated calls to exec_command do not segfault.
41+
u_cmd_out = ssh_channel.exec_command('echo -n Hello Again').stdout.decode()
42+
assert u_cmd_out == u'Hello Again' # noqa: WPS302
4043

4144

4245
def test_double_close(ssh_channel):

0 commit comments

Comments
 (0)