Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
David Conner committed Sep 26, 2024
1 parent 73904d1 commit 39beaaa
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions flexbe_core/test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import rclpy
from rclpy.executors import MultiThreadedExecutor

from std_msgs.msg import Bool, Empty, Int32, String, UInt32
from std_msgs.msg import Bool, Empty, Int32, UInt32


class CoreTestState(EventState):
Expand Down Expand Up @@ -144,7 +144,7 @@ def setUp(self):
def tearDown(self):
"""Tear down the TestCore test."""
self.node.get_logger().info(' shutting down core test %d ... ' % (self.test))
for _ in range(int(0.25*TestCore.__LOOP_COUNT)):
for _ in range(int(0.25 * TestCore.__LOOP_COUNT)):
# Allow any lingering pub/sub to clear up
rclpy.spin_once(self.node, executor=self.executor, timeout_sec=TestCore.__EXECUTE_TIMEOUT_SEC)

Expand All @@ -161,7 +161,7 @@ def tearDown(self):

# Kill it with fire to make sure not stray published topics are available
rclpy.shutdown(context=self.context)
time.sleep(TestCore.__TIME_SLEEP*2)
time.sleep(TestCore.__TIME_SLEEP * 2)

def _create(self):
"""Create the test."""
Expand Down Expand Up @@ -215,9 +215,9 @@ def _execute_state(self, state):
return outcome
except Exception as exc:
self.node.get_logger().error(f" exception in state execute for '{state.name}' ... ")
self.node.get_logger().info(f"{exc}")
self.node.get_logger().info(f'{exc}')
import traceback
self.node.get_logger().info(f"{traceback.format_exc()}")
self.node.get_logger().info(f'{traceback.format_exc()}')

def assertMessage(self, sub, topic, msg, timeout=1):
"""Check message."""
Expand Down Expand Up @@ -748,7 +748,7 @@ def execute(self, userdata):
sm = OperatableStateMachine(outcomes=['done'])
sm._state_id = 8192
sm.userdata.outside = 'outside_data'
sm.set_name("outer_sm") # No one sets this name, while .add sets names of inner states
sm.set_name('outer_sm') # No one sets this name, while .add sets names of inner states
with sm:
OperatableStateMachine.add('before_state', TestUserdataState(), transitions={'done': 'inner_sm'},
remapping={'data_in': 'outside'},
Expand Down
2 changes: 1 addition & 1 deletion flexbe_core/test/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def tearDown(self):

# Kill it with fire to make sure not stray published topics are available
rclpy.shutdown(context=self.context)
time.sleep(TestExceptions.__TIME_SLEEP*2)
time.sleep(TestExceptions.__TIME_SLEEP * 2)

def test_invalid_outcome(self):
"""Test invalid outcome."""
Expand Down
4 changes: 2 additions & 2 deletions flexbe_core/test/test_exceptions_spin.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def setUp(self):
def tearDown(self):
"""Tear down the TestExceptionsSpin test."""
self.node.get_logger().info(' shutting down exceptions test %d (%d) ... ' % (self.test, self.context.ok()))
rclpy.spin_once(self.node, executor=self.executor, timeout_sec=2*TestExceptionsSpin.__EXECUTE_TIMEOUT_SEC)
rclpy.spin_once(self.node, executor=self.executor, timeout_sec=2 * TestExceptionsSpin.__EXECUTE_TIMEOUT_SEC)

self.node.get_logger().info(' shutting down proxies in core test %d ... ' % (self.test))
shutdown_proxies()
Expand All @@ -84,7 +84,7 @@ def tearDown(self):

# Kill it with fire to make sure not stray published topics are available
rclpy.shutdown(context=self.context)
time.sleep(TestExceptionsSpin.__TIME_SLEEP*2)
time.sleep(TestExceptionsSpin.__TIME_SLEEP * 2)

def test_invalid_outcome(self):
"""Test invalid outcome."""
Expand Down
6 changes: 3 additions & 3 deletions flexbe_core/test/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def tearDown(self):

# Kill it with fire to make sure not stray published topics are available
rclpy.shutdown(context=self.context)
time.sleep(TestLogger.__TIME_SLEEP*2)
time.sleep(TestLogger.__TIME_SLEEP * 2)

def test_throttle_logger_one(self):
"""Test throttle logger one."""
Expand Down Expand Up @@ -202,7 +202,7 @@ def execute(self, userdata):
while outcome is None:
outcome = sm.execute(None)
self.assertTrue(1 < len(Logger._last_logged) <= Logger.MAX_LAST_LOGGED_SIZE)
rclpy.spin_once(self.node, executor=self.executor, timeout_sec=TestLogger.__EXECUTE_TIMEOUT_SEC*0.5)
rclpy.spin_once(self.node, executor=self.executor, timeout_sec=TestLogger.__EXECUTE_TIMEOUT_SEC * 0.5)
self.assertEqual(outcome, 'done')
self.assertEqual(state_instance._trials, 0)

Expand Down Expand Up @@ -247,7 +247,7 @@ def execute(self, userdata):
while outcome is None:
outcome = sm.execute(None)
self.assertTrue(1 < len(Logger._last_logged) <= Logger.MAX_LAST_LOGGED_SIZE)
rclpy.spin_once(self.node, executor=self.executor, timeout_sec=TestLogger.__EXECUTE_TIMEOUT_SEC*.5)
rclpy.spin_once(self.node, executor=self.executor, timeout_sec=TestLogger.__EXECUTE_TIMEOUT_SEC * 0.5)
self.assertEqual(outcome, 'done')
self.assertEqual(state_instance._trials, 0)

Expand Down
2 changes: 1 addition & 1 deletion flexbe_core/test/test_proxies.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def tearDown(self):

# Kill it with fire to make sure not stray published topics are available
rclpy.shutdown(context=self.context)
time.sleep(TestProxies.__TIME_SLEEP*5)
time.sleep(TestProxies.__TIME_SLEEP * 5)

def test_publish_subscribe(self):
"""Test publish and subscribe."""
Expand Down

0 comments on commit 39beaaa

Please sign in to comment.