Ejemplo n.º 1
0
def test_get_participant():
    dp = DomainParticipant(0)

    assert dp.participant == dp.get_participant() == dp

    tp = Topic(dp, "Message", Message)

    assert isgoodentity(tp)
    assert tp.participant == tp.get_participant() == dp

    sub = Subscriber(dp)

    assert isgoodentity(sub)
    assert sub.participant == sub.get_participant() == dp

    pub = Publisher(dp)

    assert isgoodentity(pub)
    assert pub.participant == pub.get_participant() == dp

    dr = DataReader(sub, tp)

    assert isgoodentity(dr)
    assert dr.participant == dr.get_participant() == dp

    dw = DataWriter(pub, tp)

    assert isgoodentity(dw)
    assert dw.participant == dw.get_participant() == dp
Ejemplo n.º 2
0
def test_delete_entity():
    dp = DomainParticipant(0)

    assert dp.get_participant() == dp

    reference = dp._ref
    del dp

    with pytest.raises(DDSException):
        Entity(reference).get_participant()
def test_delete_entity():
    dp = DomainParticipant(0)

    assert dp.get_participant() == dp

    reference = dp._ref
    del dp

    with pytest.raises(DDSException) as exc:
        Entity(reference).get_participant()
        
    # This test is weird, it can fail if other tests are also failing.
    # So if this test fails fix other tests first before spending any time here.
    assert exc.value.code == DDSException.DDS_RETCODE_PRECONDITION_NOT_MET