Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding topic inheritance test #237

Merged
merged 1 commit into from Mar 19, 2024

Conversation

adrianomarto
Copy link
Contributor

@adrianomarto adrianomarto commented Mar 15, 2024

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

@eboasson
Copy link
Contributor

@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
Copy link
Contributor Author

@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
Copy link
Contributor Author

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.

Copy link
Contributor

@eboasson eboasson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good except for one thing: in my understanding of the way all the Python setup happens, it also needs a reference to "pytest-asyncio" in setup.py, because otherwise a pip3 install '.[dev]' won't install it automatically if it isn't present yet.

Copy link
Contributor

@eboasson eboasson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eboasson eboasson merged commit 0b45cb8 into eclipse-cyclonedds:master Mar 19, 2024
9 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants