Skip to content

Commit

Permalink
Don't check lifespan on subscriber QoS (#523)
Browse files Browse the repository at this point in the history
  • Loading branch information
rotu authored Mar 12, 2020
1 parent 986c709 commit 211da41
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions rclpy/test/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def test_node_names_and_namespaces(self):
# test that it doesn't raise
self.node.get_node_names_and_namespaces()

def assert_qos_equal(self, expected_qos_profile, actual_qos_profile):
def assert_qos_equal(self, expected_qos_profile, actual_qos_profile, *, is_publisher):
# Depth and history are skipped because they are not retrieved.
self.assertEqual(
expected_qos_profile.durability,
Expand All @@ -187,10 +187,11 @@ def assert_qos_equal(self, expected_qos_profile, actual_qos_profile):
expected_qos_profile.reliability,
actual_qos_profile.reliability,
'Reliability is unequal')
self.assertEqual(
expected_qos_profile.lifespan,
actual_qos_profile.lifespan,
'lifespan is unequal')
if is_publisher:
self.assertEqual(
expected_qos_profile.lifespan,
actual_qos_profile.lifespan,
'lifespan is unequal')
self.assertEqual(
expected_qos_profile.deadline,
actual_qos_profile.deadline,
Expand Down Expand Up @@ -232,7 +233,7 @@ def test_get_publishers_subscriptions_info_by_topic(self):
self.assertEqual(self.node.get_namespace(), publisher_list[0].node_namespace)
self.assertEqual('test_msgs/msg/BasicTypes', publisher_list[0].topic_type)
actual_qos_profile = publisher_list[0].qos_profile
self.assert_qos_equal(qos_profile, actual_qos_profile)
self.assert_qos_equal(qos_profile, actual_qos_profile, is_publisher=True)

# Add a subscription
qos_profile2 = QoSProfile(
Expand All @@ -257,8 +258,8 @@ def test_get_publishers_subscriptions_info_by_topic(self):
self.assertEqual('test_msgs/msg/BasicTypes', subscription_list[0].topic_type)
publisher_qos_profile = publisher_list[0].qos_profile
subscription_qos_profile = subscription_list[0].qos_profile
self.assert_qos_equal(qos_profile, publisher_qos_profile)
self.assert_qos_equal(qos_profile2, subscription_qos_profile)
self.assert_qos_equal(qos_profile, publisher_qos_profile, is_publisher=True)
self.assert_qos_equal(qos_profile2, subscription_qos_profile, is_publisher=False)

# Error cases
with self.assertRaisesRegex(TypeError, 'bad argument type for built-in operation'):
Expand Down

0 comments on commit 211da41

Please sign in to comment.