blob: 16deeb43c412211d86348fb95d6a68dd352c1839 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
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
uut.closePort()
def test_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)
|