Skip to content

Commit f666dae

Browse files
committed
tests: Test capturing stderr
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
1 parent 37102e9 commit f666dae

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/unit/channel_test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ def test_exec_command(ssh_channel):
5858
exec_second_command(ssh_channel)
5959

6060

61+
def test_exec_command_stderr(ssh_channel):
62+
"""Test getting the stderr of a remotely executed command."""
63+
u_cmd = ssh_channel.exec_command('echo -n Hello World 1>&2')
64+
assert u_cmd.returncode == 0
65+
assert u_cmd.stderr.decode() == u'Hello World' # noqa: WPS302
66+
assert u_cmd.stdout.decode() == ''
67+
68+
6169
def test_double_close(ssh_channel):
6270
"""Test that closing the channel multiple times doesn't explode."""
6371
for _ in range(3): # noqa: WPS122

0 commit comments

Comments
 (0)