We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 24322de commit 754ce51Copy full SHA for 754ce51
1 file changed
tests/integration/logging_test.py
@@ -153,3 +153,18 @@ def test_session_log_level_bad():
153
error_msg = r'^Invalid log level \[99\]$'
154
with pytest.raises(LibsshSessionException, match=error_msg):
155
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