Skip to content

Commit

Permalink
test/thorlabs_tcube: fix test discovery and style
Browse files Browse the repository at this point in the history
  • Loading branch information
sbourdeauducq committed Mar 4, 2015
1 parent c2831db commit 9fad01d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions artiq/test/thorlabs_tcube.py
Expand Up @@ -5,10 +5,11 @@
from artiq.devices.thorlabs_tcube.driver import Tdc, Tpz, TdcSim, TpzSim
from artiq.language.units import V


no_hardware = bool(os.getenv("ARTIQ_NO_HARDWARE"))


class GenericTdcTest(unittest.TestCase):
class GenericTdcTest:
def test_pot_parameters(self):
test_vector = 1, 2, 3, 4, 5, 6, 7, 8
self.cont.set_pot_parameters(*test_vector)
Expand Down Expand Up @@ -82,14 +83,13 @@ def test_button_parameters(self):
self.assertEqual(test_vector, self.cont.get_button_parameters())


class GenericTpzTest(unittest.TestCase):
class GenericTpzTest:
def test_position_control_mode(self):
test_vector = 1
self.cont.set_position_control_mode(test_vector)
self.assertEqual(test_vector, self.cont.get_position_control_mode())

def test_ouput_volts(self):

for voltage in 5*V, 10*V, 15*V, \
round(self.cont.get_tpz_io_settings()[0].amount)*V:
with self.subTest(voltage=voltage):
Expand Down Expand Up @@ -135,7 +135,7 @@ def test_tpz_io_settings(self):


@unittest.skipIf(no_hardware, "no hardware")
class TestTdc(GenericTdcTest):
class TestTdc(unittest.TestCase, GenericTdcTest):
def setUp(self):
serial = os.getenv("ARTIQ_TDC001_SERIAL")
args = dict()
Expand All @@ -144,13 +144,13 @@ def setUp(self):
self.cont = Tdc(**args)


class TestTdcSim(GenericTdcTest):
class TestTdcSim(unittest.TestCase, GenericTdcTest):
def setUp(self):
self.cont = TdcSim()


@unittest.skipIf(no_hardware, "no hardware")
class TestTpz(GenericTpzTest):
class TestTpz(unittest.TestCase, GenericTpzTest):
def setUp(self):
serial = os.getenv("ARTIQ_TPZ001_SERIAL")
args = dict()
Expand All @@ -159,6 +159,6 @@ def setUp(self):
self.cont = Tpz(**args)


class TestTpzSim(GenericTpzTest):
class TestTpzSim(unittest.TestCase, GenericTpzTest):
def setUp(self):
self.cont = TpzSim()

0 comments on commit 9fad01d

Please sign in to comment.