Skip to content

Commit 754ce51

Browse files
committed
tests: Verify verbosity set on constructor works
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
1 parent 24322de commit 754ce51

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
@@ -153,3 +153,18 @@ def test_session_log_level_bad():
153153
error_msg = r'^Invalid log level \[99\]$'
154154
with pytest.raises(LibsshSessionException, match=error_msg):
155155
ssh_session.set_log_level(BAD_LOG_LEVEL)
156+
157+
158+
def test_session_log_verbosity_session(
159+
caplog: pytest.LogCaptureFixture,
160+
free_port_num: int,
161+
) -> None:
162+
"""Test setting the log level through Session constructor."""
163+
ssh_session = Session(log_verbosity=ANSIBLE_PYLIBSSH_TRACE)
164+
caplog.set_level(ANSIBLE_PYLIBSSH_TRACE)
165+
166+
with _ctx.suppress(LibsshSessionException):
167+
ssh_session.connect(host=LOCALHOST, port=free_port_num)
168+
169+
expected_poll_message = 'ssh_socket_pollcallback: Poll callback on socket'
170+
assert expected_poll_message in caplog.text

0 commit comments

Comments
 (0)