Skip to content

Commit 55e76c8

Browse files
committed
Bump threshold temporarily
1 parent 8840196 commit 55e76c8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

test/motors.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
class TestMotor(unittest.TestCase):
1111
"""Test motors"""
1212

13+
THRESHOLD_DISTANCE = 15
14+
1315
def test_rotations(self):
1416
"""Test motor rotating"""
1517
m = Motor('A')
@@ -37,7 +39,7 @@ def test_nonblocking(self):
3739
time.sleep(7)
3840
pos1 = m.get_aposition()
3941
diff = abs((last - pos1 + 180) % 360 - 180)
40-
self.assertLess(diff, 10)
42+
self.assertLess(diff, self.THRESHOLD_DISTANCE)
4143

4244
def test_nonblocking_multiple(self):
4345
"""Test motor nonblocking mode"""
@@ -62,23 +64,23 @@ def test_nonblocking_multiple(self):
6264
time.sleep(7)
6365
pos1 = m1.get_aposition()
6466
diff = abs((last - pos1 + 180) % 360 - 180)
65-
self.assertLess(diff, 10)
67+
self.assertLess(diff, self.THRESHOLD_DISTANCE)
6668
pos2 = m2.get_aposition()
6769
diff = abs((last - pos2 + 180) % 360 - 180)
68-
self.assertLess(diff, 10)
70+
self.assertLess(diff, self.THRESHOLD_DISTANCE)
6971

7072
def test_position(self):
7173
"""Test motor goes to desired position"""
7274
m = Motor('A')
7375
m.run_to_position(0)
7476
pos1 = m.get_aposition()
7577
diff = abs((0 - pos1 + 180) % 360 - 180)
76-
self.assertLess(diff, 10)
78+
self.assertLess(diff, self.THRESHOLD_DISTANCE)
7779

7880
m.run_to_position(180)
7981
pos1 = m.get_aposition()
8082
diff = abs((180 - pos1 + 180) % 360 - 180)
81-
self.assertLess(diff, 10)
83+
self.assertLess(diff, self.THRESHOLD_DISTANCE)
8284

8385
def test_time(self):
8486
"""Test motor runs for correct duration"""

0 commit comments

Comments
 (0)