def test_query_close_once_at_init(caplog): """ Test that, during initialisation, we query the closed channels only once """ with caplog.at_level(logging.DEBUG): S46('s46_test_query_once', address='GPIB::2::INSTR', visalib=visalib) assert caplog.text.count(":CLOS?") == 1
def s46_four(): """ A four channel-per-relay instrument """ driver = S46('s46_four', address='GPIB::3::INSTR', visalib=visalib) yield driver driver.close()
def s46_six(): """ A six channel-per-relay instrument """ driver = S46('s46_six', address='GPIB::2::INSTR', visalib=visalib) yield driver driver.close()
def test_runtime_error_on_bad_init(): """ If we initialize the driver from an instrument state with more then one channel per relay closed, raise a runtime error. An instrument can come to this state if previously, other software was used to control the instrument """ with pytest.raises( RuntimeError, match="The driver is initialized from an undesirable instrument state" ): S46('s46_bad_state', address='GPIB::1::INSTR', visalib=visalib)