Getting error while running pytest asyncio: asyncio.queues.QueueEmpty

54 views Asked by At

I am using pytest and pytest.asyncio to test discord bot (along with dpytest). My commands are working fine but while running the test cases, I am getting this error for few of the test cases:

asyncio.queues.QueueEmpty

@pytest.mark.asyncio
async def test_help(bot: commands.Bot):
    await dpytest.message("/help")
    assert dpytest.verify().message().content('Help for discord bot')

This is the error traceback:

.venv/lib/python3.11/site-packages/discord/ext/test/runner.py:112: in get_message
    message = sent_queue.get_nowait()

self = <PeekableQueue at 0x7f0d7b112850 maxsize=0 tasks=2>

    def get_nowait(self):
        """Remove and return an item from the queue.
    
        Return an item if one is immediately available, else raise QueueEmpty.
        """
        if self.empty():
>           raise QueueEmpty
E           asyncio.queues.QueueEmpty

/usr/lib/python3.11/asyncio/queues.py:181: QueueEmpty

This is the library codebase where I am redirected from this line: dpytest.verify().message() and it is going into the except clause. Error is coming on this line:

message = sent_queue.get_nowait()

enter image description here Can anyone provide a solution?

0

There are 0 answers