Skip to content

Commit

Permalink
Refs #21808: Apply second rev
Browse files Browse the repository at this point in the history
Signed-off-by: Mario Dominguez <[email protected]>
  • Loading branch information
Mario-DL committed Oct 21, 2024
1 parent e626daa commit 7dd6e8d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
1 change: 1 addition & 0 deletions fastdds_python/test/api/test_datareader.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,7 @@ def test_get_matched_publications(datareader, datawriter):
# The datawriter (added in the fixture) is the only
# one that should be matched
assert(1 == ihs.size())
assert(ihs[0] == datawriter.get_instance_handle())


def test_get_requested_deadline_missed_status(datareader):
Expand Down
29 changes: 19 additions & 10 deletions fastdds_python/test/api/test_datawriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,23 @@ def subscriber(reader_participant):
return reader_participant.create_subscriber(fastdds.SUBSCRIBER_QOS_DEFAULT)


@pytest.fixture
def datareader(reader_participant, reader_topic, subscriber):
datareader = subscriber.create_datareader(
reader_topic, fastdds.DATAREADER_QOS_DEFAULT)

yield datareader

assert(fastdds.RETCODE_OK ==
subscriber.delete_datareader(datareader))
assert(fastdds.RETCODE_OK ==
reader_participant.delete_topic(reader_topic))
assert(fastdds.RETCODE_OK ==
reader_participant.delete_subscriber(subscriber))
factory = fastdds.DomainParticipantFactory.get_instance()
assert(fastdds.RETCODE_OK ==
factory.delete_participant(reader_participant))

def test_assert_liveliness(manual_liveliness_datawriter_qos, datawriter):
"""
This test checks:
Expand Down Expand Up @@ -308,7 +325,7 @@ def test_get_liveliness_lost_status(datawriter):
assert(0 == status.total_count_change)


def test_get_matched_subscription_data(datawriter, reader_topic, subscriber):
def test_get_matched_subscription_data(datawriter, datareader):
"""
This test checks:
- DataWriter::get_matched_subscription_data
Expand All @@ -319,29 +336,21 @@ def test_get_matched_subscription_data(datawriter, reader_topic, subscriber):
assert(fastdds.RETCODE_BAD_PARAMETER ==
datawriter.get_matched_subscription_data(sub_data, ih))

# Add a reader and check that the datawriter has matched subscriptions
datareader = subscriber.create_datareader(reader_topic, fastdds.DATAREADER_QOS_DEFAULT)
time.sleep(1)
assert(fastdds.RETCODE_OK ==
datawriter.get_matched_subscription_data(sub_data, datareader.get_instance_handle()))
assert(sub_data.guid == datareader.guid())
assert(fastdds.RETCODE_OK ==
subscriber.delete_datareader(datareader))

def test_get_matched_subscriptions(datawriter, reader_topic, subscriber):
def test_get_matched_subscriptions(datawriter, datareader):
"""
This test checks:
- DataWriter::get_matched_subscriptions
"""
ihs = fastdds.InstanceHandleVector()
# Add a reader and check that the datawriter has matched subscriptions
datareader = subscriber.create_datareader(reader_topic, fastdds.DATAREADER_QOS_DEFAULT)
time.sleep(1)
assert(fastdds.RETCODE_OK == datawriter.get_matched_subscriptions(ihs))
assert(1 == ihs.size())
assert(ihs[0] == datareader.get_instance_handle())
assert(fastdds.RETCODE_OK ==
subscriber.delete_datareader(datareader))

def test_get_offered_deadline_missed_status(datawriter):
"""
Expand Down

0 comments on commit 7dd6e8d

Please sign in to comment.