Add tests on pytest and change dir structure
This commit is contained in:
parent
7f1db9a627
commit
353505239e
@ -1,14 +0,0 @@
|
||||
from unittest import TestCase
|
||||
|
||||
from controls.device import DeviceLifecycleState
|
||||
|
||||
|
||||
class DeviceLifecycleStateTest(TestCase):
|
||||
|
||||
def setUp(self) -> None:
|
||||
pass
|
||||
|
||||
def test_enum(self):
|
||||
# NOTE: это имеется в виду?
|
||||
# self.assertEqual(DeviceLifecycleStateTest["INIT"], DeviceLifecycleStateTest.INIT)
|
||||
self.assertEqual(DeviceLifecycleState["INIT"], DeviceLifecycleState.INIT)
|
@ -1,13 +0,0 @@
|
||||
from unittest import TestCase
|
||||
|
||||
from equipment.turtle_device import TurtleDevice
|
||||
|
||||
|
||||
class TurtleDeviceTest(TestCase):
|
||||
|
||||
def setUp(self) -> None:
|
||||
self.device = TurtleDevice()
|
||||
|
||||
def test_open(self):
|
||||
self.device.open()
|
||||
self.device.close()
|
7
tests/controls/test_device.py
Normal file
7
tests/controls/test_device.py
Normal file
@ -0,0 +1,7 @@
|
||||
import pytest
|
||||
|
||||
from controls.device import DeviceLifecycleState
|
||||
|
||||
|
||||
def test_enum():
|
||||
assert DeviceLifecycleState["INIT"] == DeviceLifecycleState.INIT
|
31
tests/equipment/test_turtle_device.py
Normal file
31
tests/equipment/test_turtle_device.py
Normal file
@ -0,0 +1,31 @@
|
||||
import pytest
|
||||
import time
|
||||
|
||||
from equipment.turtle_device import TurtleDevice
|
||||
|
||||
def test_setup():
|
||||
td = TurtleDevice() # не падает
|
||||
|
||||
def test_read():
|
||||
td = TurtleDevice()
|
||||
assert td.read("DEFAULT_ANGLEOFFSET") == 0
|
||||
|
||||
def test_write():
|
||||
td = TurtleDevice()
|
||||
value_to_pass = 10
|
||||
td.write("DEFAULT_ANGLEOFFSET", value_to_pass)
|
||||
assert td["DEFAULT_ANGLEOFFSET"] == value_to_pass
|
||||
|
||||
def test_invalidate():
|
||||
td = TurtleDevice()
|
||||
value_to_pass = 10
|
||||
td.write("DEFAULT_ANGLEOFFSET", value_to_pass)
|
||||
td.invalidate("DEFAULT_ANGLEOFFSET") # сносит логическое значение
|
||||
assert td["DEFAULT_ANGLEOFFSET"] == 0
|
||||
|
||||
def test_execute():
|
||||
td = TurtleDevice()
|
||||
td.execute("back", **{"distance": 5.0})
|
||||
assert td.turtle.pos() == (-5.0 ,0.0)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user