Giter Club home page Giter Club logo

mockafka-py's People

Contributors

alm0ra avatar dependabot[bot] avatar farbodp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mockafka-py's Issues

Async support?

AIOkafka user here trying to make some tests ๐Ÿ—ก๏ธ

`send_and_wait` doesn't properly mock `aiokafka.send_and_wait`

Describe the bug

aiokafka's version of send_and_wait has 2 positional arguments (see https://aiokafka.readthedocs.io/en/stable/api.html#aiokafka.AIOKafkaProducer.send_and_wait). However, in FakeAIOKafkaProducer these arguments aren't there and the *args and **kwargs are not properly passed from send_and_wait to _produce and you get an exception when using this function:

TypeError: FakeAIOKafkaProducer._produce() missing 1 required positional argument: 'topic'

To Reproduce
Steps to reproduce the behavior:

producer = FakeAIOKafkaProducer()
producer.send_and_wait("topic_name", "sdfjhasdfhjsa", key="datakey")

๐Ÿ’ฅ

Expected behavior
It should not throw an exception

Screenshots

/usr/local/lib/python3.12/site-packages/sentry_sdk/tracing_utils_py3.py:64: in func_with_tracing
    return func(*args, **kwargs)
src/kafka.py:90: in process
    asyncio.run(self.send_updated_records(plant_data.plant_key, updated_data))
/usr/local/lib/python3.12/asyncio/runners.py:194: in run
    return runner.run(main)
/usr/local/lib/python3.12/asyncio/runners.py:118: in run
    return self._loop.run_until_complete(task)
/usr/local/lib/python3.12/asyncio/base_events.py:685: in run_until_complete
    return future.result()
src/kafka.py:106: in send_updated_records
    await self.producer.send_and_wait(ct, serialized_record, key=plant_key)
/usr/local/lib/python3.12/site-packages/mockafka/aiokafka/aiokafka_producer.py:40: in send_and_wait
    await self.send()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <mockafka.aiokafka.aiokafka_producer.FakeAIOKafkaProducer object at 0x7f5302d6dd30>, args = ()
kwargs = {}

    async def send(self, *args, **kwargs):
>       await self._produce(**kwargs)
E       TypeError: FakeAIOKafkaProducer._produce() missing 1 required positional argument: 'topic'

Desktop (please complete the following information):

  • OS: linux
  • python version: 3.12
  • mockafka-py version: 0.1.52

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.