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

Following changes in aiohttp, the event loop arg needs to be removed #33

Merged
merged 1 commit into from
Oct 9, 2019

Conversation

MihaiBalint
Copy link
Contributor

Following changes here: https://github.com/aio-libs/aiohttp/pull/3580/files

ClientSession and CookieJar no longer accept the event loop as an argument. The following is raised:


testing_database_url = 'sqlite:////tmp/tmpnqgsxtib/opentsr.db'
loop = <uvloop.Loop running=False closed=False debug=False>
sanic_client = <function sanic_client.<locals>.create_client at 0x7f828a88d400>

    @pytest.fixture()
    def api(testing_database_url, loop, sanic_client):
        app = create_app(config={"DATABASE_URL": testing_database_url})
>       return loop.run_until_complete(sanic_client(app))

tests/conftest.py:78: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
uvloop/loop.pyx:1417: in uvloop.loop.Loop.run_until_complete
    ???
../.venv/lib/python3.6/site-packages/pytest_sanic/plugin.py:202: in create_client
    client = TestClient(app, loop=loop, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pytest_sanic.utils.TestClient object at 0x7f828aada0f0>
app = <sanic.app.Sanic object at 0x7f829004fe80>
loop = <uvloop.Loop running=False closed=False debug=False>, host = '127.0.0.1'
protocol = None, ssl = None, scheme = None, kwargs = {}

    def __init__(self, app, loop=None,
                 host='127.0.0.1',
                 protocol=None,
                 ssl=None,
                 scheme=None,
                 **kwargs):
        if not isinstance(app, Sanic):
            raise TypeError("app should be a Sanic application.")
        self._app = app
        self._loop = loop
        # we should use '127.0.0.1' in most cases.
        self._host = host
        self._ssl = ssl
        self._scheme = scheme
        self._protocol = HttpProtocol if protocol is None else protocol
        self._closed = False
        self._server = TestServer(
                    self._app, loop=self._loop,
                    protocol=self._protocol, ssl=self._ssl,
                    scheme=self._scheme)
>       cookie_jar = CookieJar(unsafe=True, loop=loop)
E       TypeError: __init__() got an unexpected keyword argument 'loop'

../.venv/lib/python3.6/site-packages/pytest_sanic/utils.py:182: TypeError

@coveralls
Copy link

Coverage Status

Coverage remained the same at 96.39% when pulling 120fe69 on MihaiBalint:master into 0d8ed9d on yunstanford:master.

@yunstanford yunstanford merged commit b21bfcf into yunstanford:master Oct 9, 2019
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

Successfully merging this pull request may close these issues.

None yet

3 participants