File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -301,6 +301,26 @@ def test_instrument_connect_message(caplog: LogCaptureFixture) -> None:
301301 assert any (rec .msg == expected_con_mssg for rec in setup_records )
302302
303303
304+ def test_instrument_logger_extra_info (awg5208 , caplog : LogCaptureFixture ) -> None :
305+ """
306+ Test that the connect_message method logs as expected
307+
308+ This test kind of belongs both here and in the tests for the instrument
309+ code, but it is more conveniently written here
310+ """
311+ extra_key = "some_extra"
312+ extra_val = "extra_value"
313+
314+ with caplog .at_level (logging .INFO ):
315+ awg5208 .visa_log .info ("test message" )
316+ assert not hasattr (caplog .records [0 ], extra_key )
317+ caplog .clear ()
318+
319+ with caplog .at_level (logging .INFO ):
320+ awg5208 .visa_log .info ("test message" , extra = {extra_key : extra_val })
321+ assert getattr (caplog .records [0 ], extra_key ) == "extra_value"
322+
323+
304324def test_installation_info_logging () -> None :
305325 """
306326 Test that installation information is logged upon starting the logging
You can’t perform that action at this time.
0 commit comments