Skip to content

Examples code breaks on recent versions of Sanic #67

@ripperdoc

Description

@ripperdoc

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions