Skip to content

Commit

Permalink
Fix action client test
Browse files Browse the repository at this point in the history
* Reset feedback member between each test
* Used timed_spin() instead of spin_once()
  • Loading branch information
jacobperron committed Jan 24, 2019
1 parent 417e8ef commit 37c98d6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rclpy/test/test_action_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,15 @@ def setUpClass(cls):
cls.executor = SingleThreadedExecutor(context=cls.context)
cls.node = rclpy.create_node('TestActionClient', context=cls.context)
cls.mock_action_server = MockActionServer(cls.node)
cls.feedback = None

@classmethod
def tearDownClass(cls):
cls.node.destroy_node()
rclpy.shutdown(context=cls.context)

def setUp(self):
self.feedback = None

def feedback_callback(self, feedback):
self.feedback = feedback

Expand Down Expand Up @@ -255,7 +257,7 @@ def test_send_goal_async_no_server(self):
ac = ActionClient(self.node, Fibonacci, 'not_fibonacci')
try:
future = ac.send_goal_async(Fibonacci.Goal())
self.assertFalse(rclpy.spin_once(self.node, executor=self.executor, timeout_sec=2.0))
self.timed_spin(2.0)
self.assertFalse(future.done())
finally:
ac.destroy()
Expand Down

0 comments on commit 37c98d6

Please sign in to comment.