CraftSpider / dpytest

A package that assists in writing tests for discord.py
MIT License
103 stars 24 forks source link

dpytest.member_join returns `None` #74

Closed swarajd closed 2 years ago

swarajd commented 2 years ago

I have a test as follows:

@pytest.mark.asyncio
async def test_bot(bot):
    mem = await dpytest.member_join(name="Foo")

    print(mem)

I would assume that it can create the user, but in this case it just returns None. Any idea why this might be? I'm using dpytest ==0.5.3

swarajd commented 2 years ago

The solution was to set the intents in the fixture:

@pytest.fixture
def bot(event_loop):
    bot = BotName(loop=event_loop, intents=discord.Intents.all())
    dpytest.configure(bot)
    return bot