Closed Gerleff closed 1 year ago
Hi Gerleff, We'll go with the option two now, so your tester functions for topics with dots will have them replaced by underscores.
I'll work on it now, and we'll try to release the patch today
Should be patched now, when you define the topics names with dots in the name, the tester mirrored functions will replace the dots with underscores (and add the prefixes)
For example:
@app.consumes(topic="my.topic.with_dots")
async def consume_func(...)
....
with Tester(app):
await tester.to_my_topic_with_dots(...)
...
You can find the patched release here: https://pypi.org/project/fastkafka/0.6.1/
Thanks for fix!
It's related with current Tester instantiation logic, where AsyncMocks are created as named tuple If consumer has topic named "testtopic" and its prefix is "on", then AsyncMocks(on test_topic=AsyncMock()) is created But if topic named is "ecosystem.project.service.test_topic", then error is raised.
Suggestions: 1) Provide argument "alias" to FastKafka.consumes and FastKafka.produces and use alias for mocks 2) Replace dots with underscores on AsyncMocks creation 3) Use dictionary instead of named tuple (my fav)