Skip to content

Commit

Permalink
tests: Test capturing stderr
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Jelen <[email protected]>
  • Loading branch information
Jakuje committed Dec 23, 2024
1 parent 887f9c3 commit 1abe0b1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/unit/channel_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ def test_exec_command(ssh_channel):
exec_second_command(ssh_channel)


def test_exec_command_stderr(ssh_channel):
"""Test getting the stderr of a remotely executed command."""
u_cmd = ssh_channel.exec_command('echo -n Hello World 1>&2')
assert u_cmd.returncode == 0
assert u_cmd.stderr.decode() == u'Hello World' # noqa: WPS302
assert u_cmd.stdout.decode() == ''


def test_double_close(ssh_channel):
"""Test that closing the channel multiple times doesn't explode."""
for _ in range(3): # noqa: WPS122
Expand Down

0 comments on commit 1abe0b1

Please sign in to comment.