Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples code breaks on recent versions of Sanic #67

Open
ripperdoc opened this issue Mar 28, 2023 · 2 comments
Open

Examples code breaks on recent versions of Sanic #67

ripperdoc opened this issue Mar 28, 2023 · 2 comments

Comments

@ripperdoc
Copy link

Pip freeze:

aiofiles==23.1.0
anyio==3.6.2
async-generator==1.10
attrs==22.2.0
certifi==2022.12.7
exceptiongroup==1.1.1
h11==0.14.0
html5tagger==1.3.0
httpcore==0.16.3
httptools==0.5.0
httpx==0.23.3
idna==3.4
iniconfig==2.0.0
multidict==6.0.4
packaging==23.0
pluggy==1.0.0
pytest==7.2.2
pytest-sanic==1.9.1
rfc3986==1.5.0
sanic==23.3.0
sanic-routing==22.8.0
sniffio==1.3.0
tomli==2.0.1
tracerite==1.1.0
ujson==5.7.0
uvloop==0.17.0
websockets==10.4

I'm using the code from README. This test fixture

@pytest.fixture
def test_cli(loop, app, sanic_client):
    return loop.run_until_complete(sanic_client(app, protocol=WebSocketProtocol))

breaks with the error AttributeError: Setting variables on Sanic instances is not allowed. You should change your Sanic instance to use instance.ctx.is_running instead. on the line 112 in utils.py:

        self.app.is_running = True

This seems to happen for at least all of the 22.x and 23.x versions of Sanic.

@ripperdoc
Copy link
Author

On Sanic 22.12.0 it instead breaks on an invalid server protocol for websocket websockets.exceptions.InvalidURI: http://127.0.0.1:62871/test_ws isn't a valid URI: scheme isn't ws or wss, and the other tests break on ConnectionResetError: [Errno 54] Connection reset by peer so not sure what's going on.

@ripperdoc ripperdoc changed the title Examples code breaks on Sanic 23.3.0 Examples code breaks on recent versions of Sanic Mar 28, 2023
@vmred
Copy link

vmred commented Aug 17, 2023

any workaround found?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants