import pytest from lab_control.jds6600 import JDS6600 from lab_control.test.mock_jds6600_device import MockJDS6600Device AVAILABLE_CHANNELS = [1, 2] @pytest.fixture def mockDevice(): d = MockJDS6600Device() yield d d.stop() @pytest.fixture def uut(mockDevice): uut = JDS6600(mockDevice.getPortName()) yield uut print("Cleaning up UUT") def tes_serialConfiguration(mockDevice): with pytest.raises(AssertionError): mockDevice.checkPortConfiguration() uut = JDS6600(mockDevice.getPortName()) mockDevice.checkPortConfiguration() def test_channelOnAndOff(uut, mockDevice): for ch in AVAILABLE_CHANNELS: assert not mockDevice.isOn(ch) #uut.setOn(ch) #assert mockDevice.isOn(ch) #uut.setOff(ch) #assert not mockDevice.isOn(ch)