eclipse-cyclonedds / cyclonedds-python

Other
54 stars 44 forks source link

Adding topic inheritance test #237

Closed adrianomarto closed 3 months ago

adrianomarto commented 3 months ago

Tests if derived topics can be published and subscribed. This test aims to demonstrate the issue #238.

eboasson commented 3 months ago

@adrianomarto I just happened to read this scary pair of sentences in a GitHub email:

This test aims to demonstrate what I believe to be a bug. I still need to figure out how to fix it.

A domain participant can only publish or subscribe to a derived topic if it also publishes or subscribes to its base topic.

So it turns out you've edited it since, but I looked at the test code anyway. It looks to me like the second assert in test_derived_topic is inconsistent with the commenting out of the base class case. Anyway, I'm sure you've seen this yourself already as well.

The other bit is that with it then surprised me that the CI is green. It turns out it skips the tests because of the asyncio bit. (It beats me why a test that is skipped like this is considered a passing test ...) I don't know the Python ecosystem, but with a bit of luck you know what needs to be done to solve this:

#[warning]async def functions are not natively supported and have been skipped.
You need to install a suitable plugin for your async framework, for example:
  - anyio
  - pytest-asyncio
  - pytest-tornasync
  - pytest-trio
  - pytest-twisted

test_topic_inheritance.py::test_derived_topic SKIPPED (async def
##[warning]async def functions are not natively supported and have been skipped.
You need to install a suitable plugin for your async framework, for example:
  - anyio
  - pytest-asyncio
  - pytest-tornasync
  - pytest-trio
  - pytest-twisted

In any case, you should be able to use the derived type for a topic without also using the base type as a topic. If that doesn't work, it's a bug, possibly a python-only bug.

adrianomarto commented 3 months ago

@eboasson, I'd like to point out that you understood my intent correctly. I observed that behaviour while using Cyclonedds v0.10.4 and Cyclonedds-Python v0.10.2. I am still trying to figure out how to reproduce the same behaviour in the CI environment. Yes, I first thought that it was working correctly, but then I noticed that my test was being skipped

adrianomarto commented 3 months ago

I am afraid we have a bug indeed. The test works fine when I publish and subscribe to the Base topic. It also works as expected when I publish and subscribe to the Base and Derived topics. However, the test fails when I only publish and subscribe to the Derived topic.