CraftSpider / dpytest

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

d.DiscordWebSocket rewrite causes TypeError #33

Closed GsakuL closed 3 years ago

GsakuL commented 4 years ago
>       dpytest.configure(bot)

tests\conftest.py:17: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
C:\Users\lukas\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\test\runner.py:302: in configure
    back.configure(client)
C:\Users\lukas\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\test\backend.py:749: in configure
    ws = FakeWebSocket()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <discord.ext.test.backend.FakeWebSocket object at 0x000001F1A09824C0>
args = (), kwargs = {}

    def __init__(self, *args, **kwargs):
>       super().__init__(*args, **kwargs)
E       TypeError: __init__() missing 1 required positional argument: 'socket'

C:\Users\lukas\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\test\backend.py:327: TypeError 

with: discord.py==1.4.1 dpytest==0.0.21

The original cause is Rapptz/discord.py@b8154e365ff584438a8d42354e56881e550bb72e.

1drturtle commented 4 years ago

I'm getting this same issue

Sillocan commented 4 years ago

I am also receiving this error. Any ideas for workarounds?

PR #32 actually has a fix for this. I'm going to pull it down and test with that.

GsakuL commented 4 years ago

I've seen your comment that the PR works. But I want to add my two cents (for context: I use that Bot+Cog class pattern). I have extracted methods in my cogs, that don't use any discord related classes/interfaces (wherever possible), and I test on them (with the command just being 'send whatever that method returns', or something like that)