Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions launch_testing_ros/launch_testing_ros/wait_for_topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ def method_1():
with WaitForTopics(topic_list, timeout=5.0):
# 'topic_1' and 'topic_2' received at least one message each
print('Given topics are receiving messages !')
<<<<<<< HEAD
print(wait_for_topics.topics_not_received()) # Should be an empty set
print(wait_for_topics.topics_received()) # Should be {'topic_1', 'topic_2'}
print(wait_for_topics.messages_received('topic_1')) # Should be [message_1, ...]
wait_for_topics.shutdown()

# Method 2, calling wait() and shutdown() manually
def method_2():
Expand All @@ -49,12 +52,6 @@ def method_2():
print(wait_for_topics.topics_not_received()) # Should be an empty set
print(wait_for_topics.topics_received()) # Should be {'topic_1', 'topic_2'}
wait_for_topics.shutdown()
=======
print(wait_for_topics.topics_not_received()) # Should be an empty set
print(wait_for_topics.topics_received()) # Should be {'topic_1', 'topic_2'}
print(wait_for_topics.messages_received('topic_1')) # Should be [message_1, ...]
wait_for_topics.shutdown()
>>>>>>> 2d125a5 (`WaitForTopics`: get content of messages for each topic (#353))
"""

def __init__(self, topic_tuples, timeout=5.0, messages_received_buffer_length=10):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,9 @@ def test_topics_successful(self, count):
message_pattern = re.compile(r'Hello World: \d+')

# Method 1 : Using the magic methods and 'with' keyword
<<<<<<< HEAD
with WaitForTopics(topic_list, timeout=2.0) as wait_for_node_object_1:
=======
with WaitForTopics(
topic_list, timeout=2.0, messages_received_buffer_length=10
) as wait_for_node_object_1:
>>>>>>> 2d125a5 (`WaitForTopics`: get content of messages for each topic (#353))
assert wait_for_node_object_1.topics_received() == expected_topics
assert wait_for_node_object_1.topics_not_received() == set()
for topic_name, _ in topic_list:
Expand Down