Skip to content

Commit

Permalink
re-increase some loop timings in tests that I had decreased to speed …
Browse files Browse the repository at this point in the history
…up tests; hopefully will avoid intermittant test failures
  • Loading branch information
David Conner committed Aug 27, 2024
1 parent 0a8d48b commit 870fa8f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions flexbe_core/test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ class TestCore(unittest.TestCase):

test = 0

__TIME_SLEEP = 0.025 # Sleep time for loops
__EXECUTE_TIMEOUT_SEC = 0.025 # Timeout in executor loops for spin once
__EXECUTE_TIMEOUT_SEC = 0.2 # 0.025 # Timeout in executor loops for spin once
__TIME_SLEEP = 0.2 # 0.025 # Sleep time for loops
__LOOP_COUNT = 50 # Number of times to execute loops for checking (total time ~ LOOP_COUNT*(TIME_SLEEP + TIMEOUT))

def __init__(self, *args, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions flexbe_core/test/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class TestExceptions(unittest.TestCase):
"""Test FlexBE Exception handling."""

test = 0
__EXECUTE_TIMEOUT_SEC=0.025
__TIME_SLEEP = 0.05 # Sleep time for loops
__EXECUTE_TIMEOUT_SEC = 0.2 # 0.025 # Timeout in executor loops for spin once
__TIME_SLEEP = 0.2 # 0.025 # Sleep time for loops

def __init__(self, *args, **kwargs):
"""Initialize TestExceptions instance."""
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 @@ -45,8 +45,8 @@ class TestExceptionsSpin(unittest.TestCase):
"""Test FlexBE Exception handling."""

test = 0
__EXECUTE_TIMEOUT_SEC=0.025
__TIME_SLEEP = 0.05 # Sleep time for loops
__EXECUTE_TIMEOUT_SEC = 0.2 # 0.025 # Timeout in executor loops for spin once
__TIME_SLEEP = 0.2 # 0.025 # Sleep time for loops

def __init__(self, *args, **kwargs):
"""Initialize TestExceptionsSpin instance."""
Expand Down
4 changes: 2 additions & 2 deletions flexbe_core/test/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class TestLogger(unittest.TestCase):
"""Test FlexBE Logger handling."""

test = 0
__EXECUTE_TIMEOUT_SEC=0.025
__TIME_SLEEP = 0.05 # Sleep time for loops
__EXECUTE_TIMEOUT_SEC = 0.2 # 0.025 # Timeout in executor loops for spin once
__TIME_SLEEP = 0.2 # 0.025 # Sleep time for loops

def __init__(self, *args, **kwargs):
"""Initialize TestLogger instance."""
Expand Down
4 changes: 2 additions & 2 deletions flexbe_core/test/test_proxies.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class TestProxies(unittest.TestCase):
"""Test the FlexBE proxies."""

test = 0
__EXECUTE_TIMEOUT_SEC=0.025
__TIME_SLEEP = 0.05 # Sleep time for loops
__EXECUTE_TIMEOUT_SEC = 0.2 # 0.025 # Timeout in executor loops for spin once
__TIME_SLEEP = 0.2 # 0.025 # Sleep time for loops

def __init__(self, *args, **kwargs):
"""Initialize TestProxies instance."""
Expand Down
6 changes: 4 additions & 2 deletions flexbe_onboard/tests/test_onboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def test_onboard_behaviors(self):
self.clear_extra_heartbeat_ready_messages()

# send the same behavior with different parameters
self.node.get_logger().info('Republish modified behavior ...')
self.node.get_logger().info('\n\nRepublish modified behavior ...')
request.arg_keys = ['param', 'invalid']
request.arg_values = ['value_1', 'should be ignored']
request.input_keys = []
Expand All @@ -224,7 +224,8 @@ def test_onboard_behaviors(self):
behavior_logs = []

# Wait for published message
end_time = time.time() + 1
self.node.get_logger().info('\n\nExecute modified behavior ...')
end_time = time.time() + 2
try:
while time.time() < end_time:
self.executor.spin_once(timeout_sec=0.1)
Expand All @@ -237,6 +238,7 @@ def test_onboard_behaviors(self):
self.executor.spin_once(timeout_sec=0.1)
except Exception as exc:
print(f'\x1b[91mException in executor: {exc}\x1b[0m')
self.node.get_logger().info(f'{behavior_logs}')
self.assertIn('value_1', behavior_logs)
self.node.get_logger().info('Done onboard testing!')
self.executor.spin_once(timeout_sec=0.1)
Expand Down

0 comments on commit 870fa8f

Please sign in to comment.