Skip to content

Commit 6dee52d

Browse files
committed
🧪 Merge NOTSET and TRACE into the same test
1 parent d3e4025 commit 6dee52d

1 file changed

Lines changed: 8 additions & 17 deletions

File tree

tests/integration/logging_test.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -107,28 +107,19 @@ def test_session_log_level_no_log(
107107
assert not caplog.records
108108

109109

110+
@pytest.mark.parametrize(
111+
'log_level',
112+
(ANSIBLE_PYLIBSSH_TRACE, logging.NOTSET),
113+
ids=('TRACE', 'NOTSET'),
114+
)
110115
def test_session_log_level_trace(
111116
caplog: pytest.LogCaptureFixture,
112117
free_port_num: int,
118+
log_level: int,
113119
) -> None:
114-
"""Test setting the log level to TRACE should provide all of the logs."""
120+
"""Test setting the most detailed log level provides all the logs."""
115121
ssh_session = Session()
116-
ssh_session.set_log_level(ANSIBLE_PYLIBSSH_TRACE)
117-
118-
with _ctx.suppress(LibsshSessionException):
119-
ssh_session.connect(host=LOCALHOST, port=free_port_num)
120-
121-
expected_poll_message = 'ssh_socket_pollcallback: Poll callback on socket'
122-
assert expected_poll_message in caplog.text
123-
124-
125-
def test_session_log_level_not_set(
126-
caplog: pytest.LogCaptureFixture,
127-
free_port_num: int,
128-
) -> None:
129-
"""Test setting the log level to NOTSET = all messages should be logged too."""
130-
ssh_session = Session()
131-
ssh_session.set_log_level(logging.NOTSET)
122+
ssh_session.set_log_level(log_level)
132123

133124
with _ctx.suppress(LibsshSessionException):
134125
ssh_session.connect(host=LOCALHOST, port=free_port_num)

0 commit comments

Comments
 (0)