EDIT: just correcting a misspelling: dpytest.run_all_events -> dpytest.run_all_loops
Is your feature request related to a problem? Please describe.
I'd like to efficiently test a cog's task loop.
The documentation is lacking an example if this is already possible in some ways.
Describe the solution you'd like
I have a bot that load a cog. This cog has 2 commands, that I easily managed to test using dpytest, and 1 task loop.
One of these commands adds a user.
The task loop that regularly checks if all users' state have changed (it fetches an API (mocked)).
Here is how it should happend:
- at the beginning there is no
user the loop shouldn't send any message
- I send the command
!adduser 1, it adds the user
- the loop should now fetch the
user 1 state from the mocked API and send a message in the channel
- I
dpytest.verify that the last message sent was about this new user state --> the loop has done its job
a way to manually trigger the loop, like dpytest.run_all_events()dpytest.run_all_loops would be great I think.
Describe alternatives you've considered
I didn't considered any, I also don't know if that's currently possible
EDIT: just correcting a misspelling:
dpytest.run_all_events->dpytest.run_all_loopsIs your feature request related to a problem? Please describe.
I'd like to efficiently test a cog's task loop.
The documentation is lacking an example if this is already possible in some ways.
Describe the solution you'd like
I have a bot that load a cog. This cog has 2 commands, that I easily managed to test using
dpytest, and 1 task loop.One of these commands adds a
user.The task loop that regularly checks if all
users' state have changed (it fetches an API (mocked)).Here is how it should happend:
userthe loop shouldn't send any message!adduser 1, it adds the useruser1 state from the mocked API and send a message in the channeldpytest.verifythat the last message sent was about this newuserstate --> the loop has done its joba way to manually trigger the loop, like
dpytest.run_all_events()dpytest.run_all_loopswould be great I think.Describe alternatives you've considered
I didn't considered any, I also don't know if that's currently possible