Skip to content

Commit 89b58c4

Browse files
committed
tests: Verify verbosity set on initialization works
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
1 parent cef92ef commit 89b58c4

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/integration/logging_test.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,18 @@ def test_session_log_level_bad():
143143
error_msg = r'^Invalid log level \[99\]$'
144144
with pytest.raises(LibsshSessionException, match=error_msg):
145145
ssh_session.set_log_level(BAD_LOG_LEVEL)
146+
147+
148+
def test_session_log_verbosity_session(
149+
caplog: pytest.LogCaptureFixture,
150+
free_port_num: int,
151+
) -> None:
152+
"""Test setting the log level through Session constructor."""
153+
ssh_session = Session(log_verbosity=ANSIBLE_PYLIBSSH_TRACE)
154+
caplog.set_level(ANSIBLE_PYLIBSSH_TRACE)
155+
156+
with _ctx.suppress(LibsshSessionException):
157+
ssh_session.connect(host=LOCALHOST, port=free_port_num)
158+
159+
expected_poll_message = 'ssh_socket_pollcallback: Poll callback on socket'
160+
assert expected_poll_message in caplog.text

0 commit comments

Comments
 (0)