diff --git a/fastdds_python/test/api/test_datareader.py b/fastdds_python/test/api/test_datareader.py index 2145a2ba..5cedbd72 100644 --- a/fastdds_python/test/api/test_datareader.py +++ b/fastdds_python/test/api/test_datareader.py @@ -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): diff --git a/fastdds_python/test/api/test_datawriter.py b/fastdds_python/test/api/test_datawriter.py index 95bbd896..1d61d7b8 100644 --- a/fastdds_python/test/api/test_datawriter.py +++ b/fastdds_python/test/api/test_datawriter.py @@ -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: @@ -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 @@ -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): """