Skip to content

Initial KeyCloak integration #464

Initial KeyCloak integration

Initial KeyCloak integration #464

GitHub Actions / JUnit report (local) failed Nov 21, 2024 in 0s

79 tests run, 45 passed, 1 skipped, 33 failed.

Annotations

Check failure on line 38 in .mypy_cache/3.11/tests/test_descriptions.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_descriptions.test_product_instructons[fi]

asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
Raw output
self = <rasenmaeher_api.db.middleware.DBConnectionMiddleware object at 0x7fa224ab4250>
scope = {'app': <fastapi.applications.FastAPI object at 0x7fa224989950>, 'asgi': {'version': '3.0'}, 'endpoint': <function get...be989b771,O=N/A'), (b'remote-addr', b'127.0.0.1'), (b'user-agent', b'ASGI-Test-Client'), (b'host', b'localhost')], ...}
receive = <bound method Queue.get of <Queue at 0x7fa2233b09d0 maxsize=0 _queue=[{'type': 'http.request', 'body': b''}, {'type': 'http.disconnect'}] tasks=2>>
send = <function ServerErrorMiddleware.__call__.<locals>._send at 0x7fa2211cdbc0>

    async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
        # Not going to handle this, pass onwards
        if scope["type"] != "http" or not self._conn_for_req:
            await self.app(scope, receive, send)
            return
    
        # Get and release connection
        async with self.gino.acquire(lazy=True):
>           await self.app(scope, receive, send)

src/rasenmaeher_api/db/middleware.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:291: in app
    solved_result = await solve_dependencies(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:638: in solve_dependencies
    solved = await call(**solved_result.values)
src/rasenmaeher_api/web/api/middleware/user.py:43: in __call__
    request.state.person = await Person.by_callsign(payload.userid)
src/rasenmaeher_api/db/people.py:258: in by_callsign
    obj = await Person.query.where(func.lower(Person.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:748: in first
    return await conn.first(clause, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:328: in first
    return await result.execute(one=True)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/base.py:214: in execute
    rows = await cursor.async_execute(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:184: in async_execute
    result, stmt = await getattr(conn, "_do_execute")(query, executor, timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2024: in _do_execute
    result = await executor(stmt, None)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   RuntimeError: Task <Task pending name='Task-1129' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseProtocol._on_waiter_completed()]> attached to a different loop

asyncpg/protocol/protocol.pyx:206: RuntimeError

During handling of the above exception, another exception occurred:

user_mtls_client = <async_asgi_testclient.testing.TestClient object at 0x7fa2210c5e50>
lang = 'fi'

    @pytest.mark.parametrize("lang", ["fi", "en"])
    @pytest.mark.asyncio(loop_scope="session")
    async def test_product_instructons(user_mtls_client: TestClient, lang: str) -> None:
        """Make sure we get product instructions"""
>       resp = await user_mtls_client.get(f"/api/v1/instructions/fake/{lang}")

tests/test_descriptions.py:38: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:313: in get
    return await self.open(*args, method="GET", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:105: in __call__
    async with self.gino.acquire(lazy=True):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:228: in release
    raise ex
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:218: in release
    await self._con.reset(timeout=budget)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1562: in reset
    await self.execute(reset_query)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:349: in execute
    result = await self._protocol.query(query, timeout)
asyncpg/protocol/protocol.pyx:360: in query
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress

asyncpg/protocol/protocol.pyx:745: InterfaceError

Check failure on line 38 in .mypy_cache/3.11/tests/test_descriptions.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_descriptions.test_product_instructons[en]

RuntimeError: Task <Task pending name='Task-1138' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
user_mtls_client = <async_asgi_testclient.testing.TestClient object at 0x7fa2210c5e50>
lang = 'en'

    @pytest.mark.parametrize("lang", ["fi", "en"])
    @pytest.mark.asyncio(loop_scope="session")
    async def test_product_instructons(user_mtls_client: TestClient, lang: str) -> None:
        """Make sure we get product instructions"""
>       resp = await user_mtls_client.get(f"/api/v1/instructions/fake/{lang}")

tests/test_descriptions.py:38: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:313: in get
    return await self.open(*args, method="GET", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:106: in __call__
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:291: in app
    solved_result = await solve_dependencies(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:638: in solve_dependencies
    solved = await call(**solved_result.values)
src/rasenmaeher_api/web/api/middleware/user.py:43: in __call__
    request.state.person = await Person.by_callsign(payload.userid)
src/rasenmaeher_api/db/people.py:258: in by_callsign
    obj = await Person.query.where(func.lower(Person.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:97: in _acquire
    return await self._root.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:864: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:849: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:140: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:132: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:517: in _get_new_connection
    con = await self._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2421: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:1049: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:886: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:931: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:802: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:1070: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:974: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-1138' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/selector_events.py:638: RuntimeError

Check failure on line 21 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]

asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
Raw output
self = <rasenmaeher_api.db.middleware.DBConnectionMiddleware object at 0x7fa224ab4250>
scope = {'app': <fastapi.applications.FastAPI object at 0x7fa224989950>, 'asgi': {'version': '3.0'}, 'endpoint': <function pos...t4AWEXsi0W3Vq4c'), (b'remote-addr', b'127.0.0.1'), (b'user-agent', b'ASGI-Test-Client'), (b'host', b'localhost')], ...}
receive = <bound method Queue.get of <Queue at 0x7fa221135190 maxsize=0 _queue=[{'type': 'http.request', 'body': b''}, {'type': 'http.disconnect'}] tasks=2>>
send = <function ServerErrorMiddleware.__call__.<locals>._send at 0x7fa221348540>

    async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
        # Not going to handle this, pass onwards
        if scope["type"] != "http" or not self._conn_for_req:
            await self.app(scope, receive, send)
            return
    
        # Get and release connection
        async with self.gino.acquire(lazy=True):
>           await self.app(scope, receive, send)

src/rasenmaeher_api/db/middleware.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:301: in app
    raw_response = await run_endpoint_function(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:212: in run_endpoint_function
    return await dependant.call(**values)
src/rasenmaeher_api/web/api/enrollment/views.py:79: in post_generate_verification_code
    _verification_code = await Enrollment.reset_approvecode4callsign(callsign=request.state.mtls_or_jwt.userid)
src/rasenmaeher_api/db/enrollments.py:221: in reset_approvecode4callsign
    obj = await Enrollment.by_callsign(callsign=callsign)
src/rasenmaeher_api/db/enrollments.py:196: in by_callsign
    obj = await Enrollment.query.where(func.lower(Enrollment.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:748: in first
    return await conn.first(clause, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:328: in first
    return await result.execute(one=True)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/base.py:214: in execute
    rows = await cursor.async_execute(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:184: in async_execute
    result, stmt = await getattr(conn, "_do_execute")(query, executor, timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2024: in _do_execute
    result = await executor(stmt, None)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   RuntimeError: Task <Task pending name='Task-1250' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseProtocol._on_waiter_completed()]> attached to a different loop

asyncpg/protocol/protocol.pyx:206: RuntimeError

During handling of the above exception, another exception occurred:

tilauspalvelu_jwt_admin_client = <async_asgi_testclient.testing.TestClient object at 0x7fa2202bd7d0>

    @pytest.mark.asyncio(loop_scope="session")
    @pytest.mark.parametrize("tilauspalvelu_jwt_admin_client", [{"test": "value", "xclientcert": False}], indirect=True)
    async def test_enroll_verif_code(tilauspalvelu_jwt_admin_client: TestClient) -> None:
        """
        Test - verification code should succeed
        """
>       resp = await tilauspalvelu_jwt_admin_client.post("/api/v1/enrollment/generate-verification-code")

tests/test_enrollment.py:21: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:329: in post
    return await self.open(*args, method="POST", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:105: in __call__
    async with self.gino.acquire(lazy=True):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:228: in release
    raise ex
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:218: in release
    await self._con.reset(timeout=budget)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1562: in reset
    await self.execute(reset_query)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:349: in execute
    result = await self._protocol.query(query, timeout)
asyncpg/protocol/protocol.pyx:360: in query
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress

asyncpg/protocol/protocol.pyx:745: InterfaceError

Check failure on line 49 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_enroll_show_verif_code[tilauspalvelu_jwt_admin_client0]

asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
Raw output
self = <rasenmaeher_api.db.middleware.DBConnectionMiddleware object at 0x7fa224ab4250>
scope = {'app': <fastapi.applications.FastAPI object at 0x7fa224989950>, 'asgi': {'version': '3.0'}, 'endpoint': <function pos...WNyres0NUKND3gc'), (b'remote-addr', b'127.0.0.1'), (b'user-agent', b'ASGI-Test-Client'), (b'host', b'localhost')], ...}
receive = <bound method Queue.get of <Queue at 0x7fa2202e4b50 maxsize=0 _queue=[{'type': 'http.request', 'body': b''}, {'type': 'http.disconnect'}] tasks=2>>
send = <function ServerErrorMiddleware.__call__.<locals>._send at 0x7fa221196480>

    async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
        # Not going to handle this, pass onwards
        if scope["type"] != "http" or not self._conn_for_req:
            await self.app(scope, receive, send)
            return
    
        # Get and release connection
        async with self.gino.acquire(lazy=True):
>           await self.app(scope, receive, send)

src/rasenmaeher_api/db/middleware.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:301: in app
    raw_response = await run_endpoint_function(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:212: in run_endpoint_function
    return await dependant.call(**values)
src/rasenmaeher_api/web/api/enrollment/views.py:79: in post_generate_verification_code
    _verification_code = await Enrollment.reset_approvecode4callsign(callsign=request.state.mtls_or_jwt.userid)
src/rasenmaeher_api/db/enrollments.py:221: in reset_approvecode4callsign
    obj = await Enrollment.by_callsign(callsign=callsign)
src/rasenmaeher_api/db/enrollments.py:196: in by_callsign
    obj = await Enrollment.query.where(func.lower(Enrollment.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:748: in first
    return await conn.first(clause, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:328: in first
    return await result.execute(one=True)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/base.py:214: in execute
    rows = await cursor.async_execute(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:184: in async_execute
    result, stmt = await getattr(conn, "_do_execute")(query, executor, timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2004: in _do_execute
    stmt = await self._get_statement(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:432: in _get_statement
    statement = await self._protocol.prepare(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   RuntimeError: Task <Task pending name='Task-1299' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseProtocol._on_waiter_completed()]> attached to a different loop

asyncpg/protocol/protocol.pyx:165: RuntimeError

During handling of the above exception, another exception occurred:

tilauspalvelu_jwt_admin_client = <async_asgi_testclient.testing.TestClient object at 0x7fa2202f76d0>

    @pytest.mark.asyncio(loop_scope="session")
    @pytest.mark.parametrize("tilauspalvelu_jwt_admin_client", [{"test": "value", "xclientcert": False}], indirect=True)
    async def test_enroll_show_verif_code(tilauspalvelu_jwt_admin_client: TestClient) -> None:
        """
        Test - show verification code info
        """
>       resp = await tilauspalvelu_jwt_admin_client.post("/api/v1/enrollment/generate-verification-code")

tests/test_enrollment.py:49: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:329: in post
    return await self.open(*args, method="POST", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:105: in __call__
    async with self.gino.acquire(lazy=True):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:228: in release
    raise ex
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:218: in release
    await self._con.reset(timeout=budget)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1562: in reset
    await self.execute(reset_query)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:349: in execute
    result = await self._protocol.query(query, timeout)
asyncpg/protocol/protocol.pyx:360: in query
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress

asyncpg/protocol/protocol.pyx:745: InterfaceError

Check failure on line 72 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_enroll_show_verifcode_bad_code[tilauspalvelu_jwt_admin_client0]

asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
Raw output
self = <rasenmaeher_api.db.middleware.DBConnectionMiddleware object at 0x7fa224ab4250>
scope = {'app': <fastapi.applications.FastAPI object at 0x7fa224989950>, 'asgi': {'version': '3.0'}, 'endpoint': <function req...LXPg5fCrH7XF0Jc'), (b'remote-addr', b'127.0.0.1'), (b'user-agent', b'ASGI-Test-Client'), (b'host', b'localhost')], ...}
receive = <bound method Queue.get of <Queue at 0x7fa220934fd0 maxsize=0 _queue=[{'type': 'http.request', 'body': b''}, {'type': 'http.disconnect'}] tasks=2>>
send = <function ServerErrorMiddleware.__call__.<locals>._send at 0x7fa220fe7100>

    async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
        # Not going to handle this, pass onwards
        if scope["type"] != "http" or not self._conn_for_req:
            await self.app(scope, receive, send)
            return
    
        # Get and release connection
        async with self.gino.acquire(lazy=True):
>           await self.app(scope, receive, send)

src/rasenmaeher_api/db/middleware.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:291: in app
    solved_result = await solve_dependencies(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:638: in solve_dependencies
    solved = await call(**solved_result.values)
src/rasenmaeher_api/web/api/middleware/user.py:43: in __call__
    request.state.person = await Person.by_callsign(payload.userid)
src/rasenmaeher_api/db/people.py:258: in by_callsign
    obj = await Person.query.where(func.lower(Person.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:748: in first
    return await conn.first(clause, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:328: in first
    return await result.execute(one=True)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/base.py:214: in execute
    rows = await cursor.async_execute(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:184: in async_execute
    result, stmt = await getattr(conn, "_do_execute")(query, executor, timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2004: in _do_execute
    stmt = await self._get_statement(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:432: in _get_statement
    statement = await self._protocol.prepare(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   RuntimeError: Task <Task pending name='Task-1352' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseProtocol._on_waiter_completed()]> attached to a different loop

asyncpg/protocol/protocol.pyx:165: RuntimeError

During handling of the above exception, another exception occurred:

tilauspalvelu_jwt_admin_client = <async_asgi_testclient.testing.TestClient object at 0x7fa220796dd0>

    @pytest.mark.asyncio(loop_scope="session")
    @pytest.mark.parametrize("tilauspalvelu_jwt_admin_client", [{"test": "value", "xclientcert": False}], indirect=True)
    async def test_enroll_show_verifcode_bad_code(tilauspalvelu_jwt_admin_client: TestClient) -> None:
        """
        Test - show verification code info
        """
>       resp = await tilauspalvelu_jwt_admin_client.get(
            "/api/v1/enrollment/show-verification-code-info?verification_code=nosuchcode"
        )

tests/test_enrollment.py:72: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:313: in get
    return await self.open(*args, method="GET", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:105: in __call__
    async with self.gino.acquire(lazy=True):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:228: in release
    raise ex
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:218: in release
    await self._con.reset(timeout=budget)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1562: in reset
    await self.execute(reset_query)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:349: in execute
    result = await self._protocol.query(query, timeout)
asyncpg/protocol/protocol.pyx:360: in query
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress

asyncpg/protocol/protocol.pyx:745: InterfaceError

Check failure on line 236 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_post_init[tilauspalvelu_jwt_admin_client0]

asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
Raw output
self = <rasenmaeher_api.db.middleware.DBConnectionMiddleware object at 0x7fa224ab4250>
scope = {'app': <fastapi.applications.FastAPI object at 0x7fa224989950>, 'asgi': {'version': '3.0'}, 'endpoint': <function req...'ASGI-Test-Client'), (b'host', b'localhost'), (b'content-type', b'application/json'), (b'content-length', b'27')], ...}
receive = <bound method Queue.get of <Queue at 0x7fa220ae9e50 maxsize=0 _queue=[{'type': 'http.disconnect'}] tasks=2>>
send = <function ServerErrorMiddleware.__call__.<locals>._send at 0x7fa2210c0d60>

    async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
        # Not going to handle this, pass onwards
        if scope["type"] != "http" or not self._conn_for_req:
            await self.app(scope, receive, send)
            return
    
        # Get and release connection
        async with self.gino.acquire(lazy=True):
>           await self.app(scope, receive, send)

src/rasenmaeher_api/db/middleware.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:291: in app
    solved_result = await solve_dependencies(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:638: in solve_dependencies
    solved = await call(**solved_result.values)
src/rasenmaeher_api/web/api/middleware/user.py:43: in __call__
    request.state.person = await Person.by_callsign(payload.userid)
src/rasenmaeher_api/db/people.py:258: in by_callsign
    obj = await Person.query.where(func.lower(Person.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:748: in first
    return await conn.first(clause, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:328: in first
    return await result.execute(one=True)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/base.py:214: in execute
    rows = await cursor.async_execute(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:184: in async_execute
    result, stmt = await getattr(conn, "_do_execute")(query, executor, timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2004: in _do_execute
    stmt = await self._get_statement(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:432: in _get_statement
    statement = await self._protocol.prepare(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   RuntimeError: Task <Task pending name='Task-1405' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseProtocol._on_waiter_completed()]> attached to a different loop

asyncpg/protocol/protocol.pyx:165: RuntimeError

During handling of the above exception, another exception occurred:

tilauspalvelu_jwt_admin_client = <async_asgi_testclient.testing.TestClient object at 0x7fa22065b350>

    @pytest.mark.asyncio(loop_scope="session")
    @pytest.mark.parametrize("tilauspalvelu_jwt_admin_client", [{"test": "value", "xclientcert": False}], indirect=True)
    async def test_post_init(tilauspalvelu_jwt_admin_client: TestClient) -> None:
        """
        Test - init new user
        """
        json_dict: Dict[Any, Any] = {"callsign": "superjuusto"}
>       resp = await tilauspalvelu_jwt_admin_client.post("/api/v1/enrollment/init", json=json_dict)

tests/test_enrollment.py:236: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:329: in post
    return await self.open(*args, method="POST", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:105: in __call__
    async with self.gino.acquire(lazy=True):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:228: in release
    raise ex
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:218: in release
    await self._con.reset(timeout=budget)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1562: in reset
    await self.execute(reset_query)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:349: in execute
    result = await self._protocol.query(query, timeout)
asyncpg/protocol/protocol.pyx:360: in query
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress

asyncpg/protocol/protocol.pyx:745: InterfaceError

Check failure on line 272 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_promote_demote[tilauspalvelu_jwt_admin_client0]

asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
Raw output
self = <rasenmaeher_api.db.middleware.DBConnectionMiddleware object at 0x7fa224ab4250>
scope = {'app': <fastapi.applications.FastAPI object at 0x7fa224989950>, 'asgi': {'version': '3.0'}, 'endpoint': <function req...'ASGI-Test-Client'), (b'host', b'localhost'), (b'content-type', b'application/json'), (b'content-length', b'21')], ...}
receive = <bound method Queue.get of <Queue at 0x7fa2208dae50 maxsize=0 _queue=[{'type': 'http.disconnect'}] tasks=2>>
send = <function ServerErrorMiddleware.__call__.<locals>._send at 0x7fa2212685e0>

    async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
        # Not going to handle this, pass onwards
        if scope["type"] != "http" or not self._conn_for_req:
            await self.app(scope, receive, send)
            return
    
        # Get and release connection
        async with self.gino.acquire(lazy=True):
>           await self.app(scope, receive, send)

src/rasenmaeher_api/db/middleware.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:291: in app
    solved_result = await solve_dependencies(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:638: in solve_dependencies
    solved = await call(**solved_result.values)
src/rasenmaeher_api/web/api/middleware/user.py:43: in __call__
    request.state.person = await Person.by_callsign(payload.userid)
src/rasenmaeher_api/db/people.py:258: in by_callsign
    obj = await Person.query.where(func.lower(Person.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:748: in first
    return await conn.first(clause, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:328: in first
    return await result.execute(one=True)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/base.py:214: in execute
    rows = await cursor.async_execute(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:184: in async_execute
    result, stmt = await getattr(conn, "_do_execute")(query, executor, timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2004: in _do_execute
    stmt = await self._get_statement(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:432: in _get_statement
    statement = await self._protocol.prepare(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   RuntimeError: Task <Task pending name='Task-1458' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseProtocol._on_waiter_completed()]> attached to a different loop

asyncpg/protocol/protocol.pyx:165: RuntimeError

During handling of the above exception, another exception occurred:

tilauspalvelu_jwt_admin_client = <async_asgi_testclient.testing.TestClient object at 0x7fa2201f3cd0>

    @pytest.mark.asyncio(loop_scope="session")
    @pytest.mark.parametrize("tilauspalvelu_jwt_admin_client", [{"test": "value", "xclientcert": False}], indirect=True)
    async def test_promote_demote(tilauspalvelu_jwt_admin_client: TestClient) -> None:
        """
        Test - promote user
        """
        json_dict: Dict[Any, Any] = {"callsign": "kissa"}
>       resp = await tilauspalvelu_jwt_admin_client.post("/api/v1/enrollment/promote", json=json_dict)

tests/test_enrollment.py:272: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:329: in post
    return await self.open(*args, method="POST", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:105: in __call__
    async with self.gino.acquire(lazy=True):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:228: in release
    raise ex
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:218: in release
    await self._con.reset(timeout=budget)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1562: in reset
    await self.execute(reset_query)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:349: in execute
    result = await self._protocol.query(query, timeout)
asyncpg/protocol/protocol.pyx:360: in query
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress

asyncpg/protocol/protocol.pyx:745: InterfaceError

Check failure on line 314 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_lock[tilauspalvelu_jwt_admin_client0]

asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
Raw output
self = <rasenmaeher_api.db.middleware.DBConnectionMiddleware object at 0x7fa224ab4250>
scope = {'app': <fastapi.applications.FastAPI object at 0x7fa224989950>, 'asgi': {'version': '3.0'}, 'endpoint': <function req...'ASGI-Test-Client'), (b'host', b'localhost'), (b'content-type', b'application/json'), (b'content-length', b'22')], ...}
receive = <bound method Queue.get of <Queue at 0x7fa2202de350 maxsize=0 _queue=[{'type': 'http.disconnect'}] tasks=2>>
send = <function ServerErrorMiddleware.__call__.<locals>._send at 0x7fa2212682c0>

    async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
        # Not going to handle this, pass onwards
        if scope["type"] != "http" or not self._conn_for_req:
            await self.app(scope, receive, send)
            return
    
        # Get and release connection
        async with self.gino.acquire(lazy=True):
>           await self.app(scope, receive, send)

src/rasenmaeher_api/db/middleware.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:291: in app
    solved_result = await solve_dependencies(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:638: in solve_dependencies
    solved = await call(**solved_result.values)
src/rasenmaeher_api/web/api/middleware/user.py:43: in __call__
    request.state.person = await Person.by_callsign(payload.userid)
src/rasenmaeher_api/db/people.py:258: in by_callsign
    obj = await Person.query.where(func.lower(Person.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:748: in first
    return await conn.first(clause, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:328: in first
    return await result.execute(one=True)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/base.py:214: in execute
    rows = await cursor.async_execute(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:184: in async_execute
    result, stmt = await getattr(conn, "_do_execute")(query, executor, timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2004: in _do_execute
    stmt = await self._get_statement(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:432: in _get_statement
    statement = await self._protocol.prepare(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   RuntimeError: Task <Task pending name='Task-1511' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseProtocol._on_waiter_completed()]> attached to a different loop

asyncpg/protocol/protocol.pyx:165: RuntimeError

During handling of the above exception, another exception occurred:

tilauspalvelu_jwt_admin_client = <async_asgi_testclient.testing.TestClient object at 0x7fa220d72bd0>

    @pytest.mark.asyncio(loop_scope="session")
    @pytest.mark.parametrize("tilauspalvelu_jwt_admin_client", [{"test": "value", "xclientcert": False}], indirect=True)
    async def test_lock(tilauspalvelu_jwt_admin_client: TestClient) -> None:
        """
        Test - lock
        """
        json_dict: Dict[Any, Any] = {"callsign": "lockme"}
>       resp = await tilauspalvelu_jwt_admin_client.post("/api/v1/enrollment/init", json=json_dict)

tests/test_enrollment.py:314: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:329: in post
    return await self.open(*args, method="POST", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:105: in __call__
    async with self.gino.acquire(lazy=True):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:228: in release
    raise ex
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:218: in release
    await self._con.reset(timeout=budget)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1562: in reset
    await self.execute(reset_query)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:349: in execute
    result = await self._protocol.query(query, timeout)
asyncpg/protocol/protocol.pyx:360: in query
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress

asyncpg/protocol/protocol.pyx:745: InterfaceError

Check failure on line 346 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_accept[tilauspalvelu_jwt_admin_client0]

asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
Raw output
self = <rasenmaeher_api.db.middleware.DBConnectionMiddleware object at 0x7fa224ab4250>
scope = {'app': <fastapi.applications.FastAPI object at 0x7fa224989950>, 'asgi': {'version': '3.0'}, 'endpoint': <function req...'ASGI-Test-Client'), (b'host', b'localhost'), (b'content-type', b'application/json'), (b'content-length', b'24')], ...}
receive = <bound method Queue.get of <Queue at 0x7fa220bcc9d0 maxsize=0 _queue=[{'type': 'http.disconnect'}] tasks=2>>
send = <function ServerErrorMiddleware.__call__.<locals>._send at 0x7fa221268ea0>

    async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
        # Not going to handle this, pass onwards
        if scope["type"] != "http" or not self._conn_for_req:
            await self.app(scope, receive, send)
            return
    
        # Get and release connection
        async with self.gino.acquire(lazy=True):
>           await self.app(scope, receive, send)

src/rasenmaeher_api/db/middleware.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:291: in app
    solved_result = await solve_dependencies(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:638: in solve_dependencies
    solved = await call(**solved_result.values)
src/rasenmaeher_api/web/api/middleware/user.py:43: in __call__
    request.state.person = await Person.by_callsign(payload.userid)
src/rasenmaeher_api/db/people.py:258: in by_callsign
    obj = await Person.query.where(func.lower(Person.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:748: in first
    return await conn.first(clause, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:328: in first
    return await result.execute(one=True)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/base.py:214: in execute
    rows = await cursor.async_execute(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:184: in async_execute
    result, stmt = await getattr(conn, "_do_execute")(query, executor, timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2004: in _do_execute
    stmt = await self._get_statement(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:432: in _get_statement
    statement = await self._protocol.prepare(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   RuntimeError: Task <Task pending name='Task-1564' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseProtocol._on_waiter_completed()]> attached to a different loop

asyncpg/protocol/protocol.pyx:165: RuntimeError

During handling of the above exception, another exception occurred:

tilauspalvelu_jwt_admin_client = <async_asgi_testclient.testing.TestClient object at 0x7fa22054b2d0>

    @pytest.mark.asyncio(loop_scope="session")
    @pytest.mark.parametrize("tilauspalvelu_jwt_admin_client", [{"test": "value", "xclientcert": False}], indirect=True)
    async def test_accept(tilauspalvelu_jwt_admin_client: TestClient) -> None:
        """
        Test - accept enrollment
        """
        json_dict: Dict[Any, Any] = {"callsign": "acceptme"}
>       resp = await tilauspalvelu_jwt_admin_client.post("/api/v1/enrollment/init", json=json_dict)

tests/test_enrollment.py:346: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:329: in post
    return await self.open(*args, method="POST", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:105: in __call__
    async with self.gino.acquire(lazy=True):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:228: in release
    raise ex
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:218: in release
    await self._con.reset(timeout=budget)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1562: in reset
    await self.execute(reset_query)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:349: in execute
    result = await self._protocol.query(query, timeout)
asyncpg/protocol/protocol.pyx:360: in query
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress

asyncpg/protocol/protocol.pyx:745: InterfaceError

Check failure on line 387 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_accept_no_such_user[tilauspalvelu_jwt_admin_client0]

asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
Raw output
self = <rasenmaeher_api.db.middleware.DBConnectionMiddleware object at 0x7fa224ab4250>
scope = {'app': <fastapi.applications.FastAPI object at 0x7fa224989950>, 'asgi': {'version': '3.0'}, 'endpoint': <function pos...'ASGI-Test-Client'), (b'host', b'localhost'), (b'content-type', b'application/json'), (b'content-length', b'58')], ...}
receive = <bound method Queue.get of <Queue at 0x7fa220c6d210 maxsize=0 _queue=[{'type': 'http.disconnect'}] tasks=2>>
send = <function ServerErrorMiddleware.__call__.<locals>._send at 0x7fa22126a700>

    async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
        # Not going to handle this, pass onwards
        if scope["type"] != "http" or not self._conn_for_req:
            await self.app(scope, receive, send)
            return
    
        # Get and release connection
        async with self.gino.acquire(lazy=True):
>           await self.app(scope, receive, send)

src/rasenmaeher_api/db/middleware.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:291: in app
    solved_result = await solve_dependencies(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:638: in solve_dependencies
    solved = await call(**solved_result.values)
src/rasenmaeher_api/web/api/middleware/user.py:43: in __call__
    request.state.person = await Person.by_callsign(payload.userid)
src/rasenmaeher_api/db/people.py:258: in by_callsign
    obj = await Person.query.where(func.lower(Person.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:748: in first
    return await conn.first(clause, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:328: in first
    return await result.execute(one=True)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/base.py:214: in execute
    rows = await cursor.async_execute(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:184: in async_execute
    result, stmt = await getattr(conn, "_do_execute")(query, executor, timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2004: in _do_execute
    stmt = await self._get_statement(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:432: in _get_statement
    statement = await self._protocol.prepare(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   RuntimeError: Task <Task pending name='Task-1617' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseProtocol._on_waiter_completed()]> attached to a different loop

asyncpg/protocol/protocol.pyx:165: RuntimeError

During handling of the above exception, another exception occurred:

tilauspalvelu_jwt_admin_client = <async_asgi_testclient.testing.TestClient object at 0x7fa220822650>

    @pytest.mark.asyncio(loop_scope="session")
    @pytest.mark.parametrize("tilauspalvelu_jwt_admin_client", [{"test": "value", "xclientcert": False}], indirect=True)
    async def test_accept_no_such_user(tilauspalvelu_jwt_admin_client: TestClient) -> None:
        """
        Test - accept a ghost
        """
        json_dict: Dict[Any, Any] = {"callsign": "duhnosuchuser", "approvecode": "nosuchcode"}
>       resp = await tilauspalvelu_jwt_admin_client.post("/api/v1/enrollment/accept", json=json_dict)

tests/test_enrollment.py:387: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:329: in post
    return await self.open(*args, method="POST", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:105: in __call__
    async with self.gino.acquire(lazy=True):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:228: in release
    raise ex
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:218: in release
    await self._con.reset(timeout=budget)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1562: in reset
    await self.execute(reset_query)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:349: in execute
    result = await self._protocol.query(query, timeout)
asyncpg/protocol/protocol.pyx:360: in query
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress

asyncpg/protocol/protocol.pyx:745: InterfaceError

Check failure on line 402 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_invitecode_create[tilauspalvelu_jwt_admin_client0]

asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
Raw output
self = <rasenmaeher_api.db.middleware.DBConnectionMiddleware object at 0x7fa224ab4250>
scope = {'app': <fastapi.applications.FastAPI object at 0x7fa224989950>, 'asgi': {'version': '3.0'}, 'endpoint': <function pos...FbJ5-oQ1jV4u8v4'), (b'remote-addr', b'127.0.0.1'), (b'user-agent', b'ASGI-Test-Client'), (b'host', b'localhost')], ...}
receive = <bound method Queue.get of <Queue at 0x7fa220be8310 maxsize=0 _queue=[{'type': 'http.request', 'body': b''}, {'type': 'http.disconnect'}] tasks=2>>
send = <function ServerErrorMiddleware.__call__.<locals>._send at 0x7fa220f61080>

    async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
        # Not going to handle this, pass onwards
        if scope["type"] != "http" or not self._conn_for_req:
            await self.app(scope, receive, send)
            return
    
        # Get and release connection
        async with self.gino.acquire(lazy=True):
>           await self.app(scope, receive, send)

src/rasenmaeher_api/db/middleware.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:291: in app
    solved_result = await solve_dependencies(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:638: in solve_dependencies
    solved = await call(**solved_result.values)
src/rasenmaeher_api/web/api/middleware/user.py:43: in __call__
    request.state.person = await Person.by_callsign(payload.userid)
src/rasenmaeher_api/db/people.py:258: in by_callsign
    obj = await Person.query.where(func.lower(Person.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:748: in first
    return await conn.first(clause, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:328: in first
    return await result.execute(one=True)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/base.py:214: in execute
    rows = await cursor.async_execute(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:184: in async_execute
    result, stmt = await getattr(conn, "_do_execute")(query, executor, timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2004: in _do_execute
    stmt = await self._get_statement(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:432: in _get_statement
    statement = await self._protocol.prepare(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   RuntimeError: Task <Task pending name='Task-1670' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseProtocol._on_waiter_completed()]> attached to a different loop

asyncpg/protocol/protocol.pyx:165: RuntimeError

During handling of the above exception, another exception occurred:

tilauspalvelu_jwt_admin_client = <async_asgi_testclient.testing.TestClient object at 0x7fa213e2e590>

    @pytest.mark.asyncio(loop_scope="session")
    @pytest.mark.parametrize("tilauspalvelu_jwt_admin_client", [{"test": "value", "xclientcert": False}], indirect=True)
    async def test_invitecode_create(tilauspalvelu_jwt_admin_client: TestClient) -> None:
        """
        Test - create invite code
        """
        # json_dict: Dict[Any, Any] = {"callsign": "duhnosuchuser"}
>       resp = await tilauspalvelu_jwt_admin_client.post("/api/v1/enrollment/invitecode/create")

tests/test_enrollment.py:402: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:329: in post
    return await self.open(*args, method="POST", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:105: in __call__
    async with self.gino.acquire(lazy=True):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:228: in release
    raise ex
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:218: in release
    await self._con.reset(timeout=budget)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1562: in reset
    await self.execute(reset_query)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:349: in execute
    result = await self._protocol.query(query, timeout)
asyncpg/protocol/protocol.pyx:360: in query
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress

asyncpg/protocol/protocol.pyx:745: InterfaceError

Check failure on line 436 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_invitecode_dectivate[tilauspalvelu_jwt_admin_client0]

asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
Raw output
self = <rasenmaeher_api.db.middleware.DBConnectionMiddleware object at 0x7fa224ab4250>
scope = {'app': <fastapi.applications.FastAPI object at 0x7fa224989950>, 'asgi': {'version': '3.0'}, 'endpoint': <function pos...yVVHskLZ5d52FFo'), (b'remote-addr', b'127.0.0.1'), (b'user-agent', b'ASGI-Test-Client'), (b'host', b'localhost')], ...}
receive = <bound method Queue.get of <Queue at 0x7fa2208b5b50 maxsize=0 _queue=[{'type': 'http.request', 'body': b''}, {'type': 'http.disconnect'}] tasks=2>>
send = <function ServerErrorMiddleware.__call__.<locals>._send at 0x7fa220f61da0>

    async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
        # Not going to handle this, pass onwards
        if scope["type"] != "http" or not self._conn_for_req:
            await self.app(scope, receive, send)
            return
    
        # Get and release connection
        async with self.gino.acquire(lazy=True):
>           await self.app(scope, receive, send)

src/rasenmaeher_api/db/middleware.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:291: in app
    solved_result = await solve_dependencies(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:638: in solve_dependencies
    solved = await call(**solved_result.values)
src/rasenmaeher_api/web/api/middleware/user.py:43: in __call__
    request.state.person = await Person.by_callsign(payload.userid)
src/rasenmaeher_api/db/people.py:258: in by_callsign
    obj = await Person.query.where(func.lower(Person.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:748: in first
    return await conn.first(clause, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:328: in first
    return await result.execute(one=True)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/base.py:214: in execute
    rows = await cursor.async_execute(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:184: in async_execute
    result, stmt = await getattr(conn, "_do_execute")(query, executor, timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2004: in _do_execute
    stmt = await self._get_statement(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:432: in _get_statement
    statement = await self._protocol.prepare(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   RuntimeError: Task <Task pending name='Task-1723' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseProtocol._on_waiter_completed()]> attached to a different loop

asyncpg/protocol/protocol.pyx:165: RuntimeError

During handling of the above exception, another exception occurred:

tilauspalvelu_jwt_admin_client = <async_asgi_testclient.testing.TestClient object at 0x7fa220443150>

    @pytest.mark.asyncio(loop_scope="session")
    @pytest.mark.parametrize("tilauspalvelu_jwt_admin_client", [{"test": "value", "xclientcert": False}], indirect=True)
    async def test_invitecode_dectivate(tilauspalvelu_jwt_admin_client: TestClient) -> None:
        """
        Test - deactivate invite code
        """
>       resp = await tilauspalvelu_jwt_admin_client.post("/api/v1/enrollment/invitecode/create")

tests/test_enrollment.py:436: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:329: in post
    return await self.open(*args, method="POST", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:105: in __call__
    async with self.gino.acquire(lazy=True):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:228: in release
    raise ex
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:218: in release
    await self._con.reset(timeout=budget)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1562: in reset
    await self.execute(reset_query)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:349: in execute
    result = await self._protocol.query(query, timeout)
asyncpg/protocol/protocol.pyx:360: in query
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress

asyncpg/protocol/protocol.pyx:745: InterfaceError

Check failure on line 464 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_invitecode_activate[tilauspalvelu_jwt_admin_client0]

asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
Raw output
self = <rasenmaeher_api.db.middleware.DBConnectionMiddleware object at 0x7fa224ab4250>
scope = {'app': <fastapi.applications.FastAPI object at 0x7fa224989950>, 'asgi': {'version': '3.0'}, 'endpoint': <function pos...p3CqgZFJW9a7Bcc'), (b'remote-addr', b'127.0.0.1'), (b'user-agent', b'ASGI-Test-Client'), (b'host', b'localhost')], ...}
receive = <bound method Queue.get of <Queue at 0x7fa220a789d0 maxsize=0 _queue=[{'type': 'http.request', 'body': b''}, {'type': 'http.disconnect'}] tasks=2>>
send = <function ServerErrorMiddleware.__call__.<locals>._send at 0x7fa220f61760>

    async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
        # Not going to handle this, pass onwards
        if scope["type"] != "http" or not self._conn_for_req:
            await self.app(scope, receive, send)
            return
    
        # Get and release connection
        async with self.gino.acquire(lazy=True):
>           await self.app(scope, receive, send)

src/rasenmaeher_api/db/middleware.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:291: in app
    solved_result = await solve_dependencies(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:638: in solve_dependencies
    solved = await call(**solved_result.values)
src/rasenmaeher_api/web/api/middleware/user.py:43: in __call__
    request.state.person = await Person.by_callsign(payload.userid)
src/rasenmaeher_api/db/people.py:258: in by_callsign
    obj = await Person.query.where(func.lower(Person.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:748: in first
    return await conn.first(clause, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:328: in first
    return await result.execute(one=True)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/base.py:214: in execute
    rows = await cursor.async_execute(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:184: in async_execute
    result, stmt = await getattr(conn, "_do_execute")(query, executor, timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2004: in _do_execute
    stmt = await self._get_statement(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:432: in _get_statement
    statement = await self._protocol.prepare(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   RuntimeError: Task <Task pending name='Task-1776' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseProtocol._on_waiter_completed()]> attached to a different loop

asyncpg/protocol/protocol.pyx:165: RuntimeError

During handling of the above exception, another exception occurred:

tilauspalvelu_jwt_admin_client = <async_asgi_testclient.testing.TestClient object at 0x7fa2201670d0>

    @pytest.mark.asyncio(loop_scope="session")
    @pytest.mark.parametrize("tilauspalvelu_jwt_admin_client", [{"test": "value", "xclientcert": False}], indirect=True)
    async def test_invitecode_activate(tilauspalvelu_jwt_admin_client: TestClient) -> None:
        """
        Test - activate invite code
        """
>       resp = await tilauspalvelu_jwt_admin_client.post("/api/v1/enrollment/invitecode/create")

tests/test_enrollment.py:464: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:329: in post
    return await self.open(*args, method="POST", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:105: in __call__
    async with self.gino.acquire(lazy=True):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:228: in release
    raise ex
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:218: in release
    await self._con.reset(timeout=budget)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1562: in reset
    await self.execute(reset_query)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:349: in execute
    result = await self._protocol.query(query, timeout)
asyncpg/protocol/protocol.pyx:360: in query
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress

asyncpg/protocol/protocol.pyx:745: InterfaceError

Check failure on line 35 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_enroll_verif_code_fail_no_jwt

RuntimeError: Task <Task pending name='Task-1785' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
unauth_client_session = <async_asgi_testclient.testing.TestClient object at 0x7fa223398c10>

    @pytest.mark.asyncio(loop_scope="session")
    async def test_enroll_verif_code_fail_no_jwt(unauth_client_session: TestClient) -> None:
        """
        Test - No JWT --> fail
        """
    
>       resp = await unauth_client_session.post("/api/v1/enrollment/generate-verification-code")

tests/test_enrollment.py:35: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:329: in post
    return await self.open(*args, method="POST", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:106: in __call__
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:301: in app
    raw_response = await run_endpoint_function(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:212: in run_endpoint_function
    return await dependant.call(**values)
src/rasenmaeher_api/web/api/enrollment/views.py:79: in post_generate_verification_code
    _verification_code = await Enrollment.reset_approvecode4callsign(callsign=request.state.mtls_or_jwt.userid)
src/rasenmaeher_api/db/enrollments.py:221: in reset_approvecode4callsign
    obj = await Enrollment.by_callsign(callsign=callsign)
src/rasenmaeher_api/db/enrollments.py:196: in by_callsign
    obj = await Enrollment.query.where(func.lower(Enrollment.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:97: in _acquire
    return await self._root.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:864: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:849: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:140: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:132: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:517: in _get_new_connection
    con = await self._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2421: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:1049: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:886: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:931: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:802: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:1070: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:974: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-1785' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/selector_events.py:638: RuntimeError

Check failure on line 111 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_show_verifcode_no_permission

RuntimeError: Task <Task pending name='Task-1806' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
tilauspalvelu_jwt_user_client = <async_asgi_testclient.testing.TestClient object at 0x7fa22042cc90>

    @pytest.mark.asyncio(loop_scope="session")
    async def test_show_verifcode_no_permission(tilauspalvelu_jwt_user_client: TestClient) -> None:
        """
        Test - no such code --> fail
        """
>       resp = await tilauspalvelu_jwt_user_client.get(
            "/api/v1/enrollment/show-verification-code-info?verification_code=nosuchcode"
        )

tests/test_enrollment.py:111: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:313: in get
    return await self.open(*args, method="GET", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:106: in __call__
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:291: in app
    solved_result = await solve_dependencies(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:638: in solve_dependencies
    solved = await call(**solved_result.values)
src/rasenmaeher_api/web/api/middleware/user.py:43: in __call__
    request.state.person = await Person.by_callsign(payload.userid)
src/rasenmaeher_api/db/people.py:258: in by_callsign
    obj = await Person.query.where(func.lower(Person.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:97: in _acquire
    return await self._root.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:864: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:849: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:140: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:132: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:517: in _get_new_connection
    con = await self._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2421: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:1049: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:886: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:931: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:802: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:1070: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:974: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-1806' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/selector_events.py:638: RuntimeError

Check failure on line 126 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_show_verifcode_sub_is_bonkers

RuntimeError: Task <Task pending name='Task-1822' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
tilauspalvelu_jwt_without_proper_user_client = <async_asgi_testclient.testing.TestClient object at 0x7fa2207ae390>

    @pytest.mark.asyncio(loop_scope="session")
    async def test_show_verifcode_sub_is_bonkers(tilauspalvelu_jwt_without_proper_user_client: TestClient) -> None:
        """
        Test - sub in JWT cannot be found
        """
>       resp = await tilauspalvelu_jwt_without_proper_user_client.get(
            "/api/v1/enrollment/show-verification-code-info?verification_code=nosuchcode"
        )

tests/test_enrollment.py:126: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:313: in get
    return await self.open(*args, method="GET", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:106: in __call__
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:291: in app
    solved_result = await solve_dependencies(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:638: in solve_dependencies
    solved = await call(**solved_result.values)
src/rasenmaeher_api/web/api/middleware/user.py:43: in __call__
    request.state.person = await Person.by_callsign(payload.userid)
src/rasenmaeher_api/db/people.py:258: in by_callsign
    obj = await Person.query.where(func.lower(Person.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:97: in _acquire
    return await self._root.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:864: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:849: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:140: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:132: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:517: in _get_new_connection
    con = await self._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2421: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:1049: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:886: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:931: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:802: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:1070: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:974: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-1822' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/selector_events.py:638: RuntimeError

Check failure on line 141 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_have_i_been_accepted_yes

RuntimeError: Task <Task pending name='Task-1830' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
tilauspalvelu_jwt_user_client = <async_asgi_testclient.testing.TestClient object at 0x7fa22042cc90>

    @pytest.mark.asyncio(loop_scope="session")
    async def test_have_i_been_accepted_yes(tilauspalvelu_jwt_user_client: TestClient) -> None:
        """
        Test - have i been accepted, yes
        """
>       resp = await tilauspalvelu_jwt_user_client.get("/api/v1/enrollment/have-i-been-accepted")

tests/test_enrollment.py:141: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:313: in get
    return await self.open(*args, method="GET", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:106: in __call__
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:301: in app
    raw_response = await run_endpoint_function(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:212: in run_endpoint_function
    return await dependant.call(**values)
src/rasenmaeher_api/web/api/enrollment/views.py:120: in request_have_i_been_accepted
    enrollment = await Enrollment.by_callsign(callsign=request.state.mtls_or_jwt.userid)
src/rasenmaeher_api/db/enrollments.py:196: in by_callsign
    obj = await Enrollment.query.where(func.lower(Enrollment.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:97: in _acquire
    return await self._root.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:864: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:849: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:140: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:132: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:517: in _get_new_connection
    con = await self._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2421: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:1049: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:886: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:931: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:802: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:1070: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:974: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-1830' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/selector_events.py:638: RuntimeError

Check failure on line 154 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_have_i_been_accepted_no

RuntimeError: Task <Task pending name='Task-1847' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
tilauspalvelu_jwt_user_koira_client = <async_asgi_testclient.testing.TestClient object at 0x7fa220182bd0>

    @pytest.mark.asyncio(loop_scope="session")
    async def test_have_i_been_accepted_no(tilauspalvelu_jwt_user_koira_client: TestClient) -> None:
        """
        Test - have i been accepted, no
        """
>       resp = await tilauspalvelu_jwt_user_koira_client.get("/api/v1/enrollment/have-i-been-accepted")

tests/test_enrollment.py:154: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:313: in get
    return await self.open(*args, method="GET", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:106: in __call__
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:301: in app
    raw_response = await run_endpoint_function(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:212: in run_endpoint_function
    return await dependant.call(**values)
src/rasenmaeher_api/web/api/enrollment/views.py:120: in request_have_i_been_accepted
    enrollment = await Enrollment.by_callsign(callsign=request.state.mtls_or_jwt.userid)
src/rasenmaeher_api/db/enrollments.py:196: in by_callsign
    obj = await Enrollment.query.where(func.lower(Enrollment.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:97: in _acquire
    return await self._root.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:864: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:849: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:140: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:132: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:517: in _get_new_connection
    con = await self._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2421: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:1049: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:886: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:931: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:802: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:1070: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:974: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-1847' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/selector_events.py:638: RuntimeError

Check failure on line 181 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_status_koira

asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
Raw output
self = <rasenmaeher_api.db.middleware.DBConnectionMiddleware object at 0x7fa224ab4250>
scope = {'app': <fastapi.applications.FastAPI object at 0x7fa224989950>, 'asgi': {'version': '3.0'}, 'endpoint': <function req...Opl89--l5JMsWew'), (b'remote-addr', b'127.0.0.1'), (b'user-agent', b'ASGI-Test-Client'), (b'host', b'localhost')], ...}
receive = <bound method Queue.get of <Queue at 0x7fa220c8c8d0 maxsize=0 _queue=[{'type': 'http.request', 'body': b''}, {'type': 'http.disconnect'}] tasks=2>>
send = <function ServerErrorMiddleware.__call__.<locals>._send at 0x7fa220ff4cc0>

    async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
        # Not going to handle this, pass onwards
        if scope["type"] != "http" or not self._conn_for_req:
            await self.app(scope, receive, send)
            return
    
        # Get and release connection
        async with self.gino.acquire(lazy=True):
>           await self.app(scope, receive, send)

src/rasenmaeher_api/db/middleware.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:301: in app
    raw_response = await run_endpoint_function(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:212: in run_endpoint_function
    return await dependant.call(**values)
src/rasenmaeher_api/web/api/enrollment/views.py:139: in request_enrolment_status
    obj = await Enrollment.by_callsign(params.callsign)
src/rasenmaeher_api/db/enrollments.py:196: in by_callsign
    obj = await Enrollment.query.where(func.lower(Enrollment.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:748: in first
    return await conn.first(clause, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:328: in first
    return await result.execute(one=True)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/base.py:214: in execute
    rows = await cursor.async_execute(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:184: in async_execute
    result, stmt = await getattr(conn, "_do_execute")(query, executor, timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2004: in _do_execute
    stmt = await self._get_statement(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:432: in _get_statement
    statement = await self._protocol.prepare(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   RuntimeError: Task <Task pending name='Task-1912' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseProtocol._on_waiter_completed()]> attached to a different loop

asyncpg/protocol/protocol.pyx:165: RuntimeError

During handling of the above exception, another exception occurred:

tilauspalvelu_jwt_admin_client = <async_asgi_testclient.testing.TestClient object at 0x7fa2201be410>

    @pytest.mark.asyncio(loop_scope="session")
    async def test_status_koira(tilauspalvelu_jwt_admin_client: TestClient) -> None:
        """
        Test - get status
        """
>       resp = await tilauspalvelu_jwt_admin_client.get("/api/v1/enrollment/status?callsign=koira")

tests/test_enrollment.py:181: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:313: in get
    return await self.open(*args, method="GET", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:105: in __call__
    async with self.gino.acquire(lazy=True):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:228: in release
    raise ex
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:218: in release
    await self._con.reset(timeout=budget)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1562: in reset
    await self.execute(reset_query)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:349: in execute
    result = await self._protocol.query(query, timeout)
asyncpg/protocol/protocol.pyx:360: in query
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress

asyncpg/protocol/protocol.pyx:745: InterfaceError

Check failure on line 193 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_status_not_found

RuntimeError: Task <Task pending name='Task-1921' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
tilauspalvelu_jwt_admin_client = <async_asgi_testclient.testing.TestClient object at 0x7fa2201be410>

    @pytest.mark.asyncio(loop_scope="session")
    async def test_status_not_found(tilauspalvelu_jwt_admin_client: TestClient) -> None:
        """
        Test - no such status
        """
>       resp = await tilauspalvelu_jwt_admin_client.get("/api/v1/enrollment/status?callsign=ponikadoksissa")

tests/test_enrollment.py:193: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:313: in get
    return await self.open(*args, method="GET", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:106: in __call__
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:301: in app
    raw_response = await run_endpoint_function(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:212: in run_endpoint_function
    return await dependant.call(**values)
src/rasenmaeher_api/web/api/enrollment/views.py:139: in request_enrolment_status
    obj = await Enrollment.by_callsign(params.callsign)
src/rasenmaeher_api/db/enrollments.py:196: in by_callsign
    obj = await Enrollment.query.where(func.lower(Enrollment.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:97: in _acquire
    return await self._root.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:864: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:849: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:140: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:132: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:517: in _get_new_connection
    con = await self._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2421: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:1049: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:886: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:931: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:802: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:1070: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:974: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-1921' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/selector_events.py:638: RuntimeError

Check failure on line 206 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_list_as_adm

RuntimeError: Task <Task pending name='Task-1929' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
tilauspalvelu_jwt_admin_client = <async_asgi_testclient.testing.TestClient object at 0x7fa2201be410>

    @pytest.mark.asyncio(loop_scope="session")
    async def test_list_as_adm(tilauspalvelu_jwt_admin_client: TestClient) -> None:
        """
        Test - list enrollments
        """
>       resp = await tilauspalvelu_jwt_admin_client.get("/api/v1/enrollment/list")

tests/test_enrollment.py:206: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:313: in get
    return await self.open(*args, method="GET", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:106: in __call__
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:291: in app
    solved_result = await solve_dependencies(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:638: in solve_dependencies
    solved = await call(**solved_result.values)
src/rasenmaeher_api/web/api/middleware/user.py:43: in __call__
    request.state.person = await Person.by_callsign(payload.userid)
src/rasenmaeher_api/db/people.py:258: in by_callsign
    obj = await Person.query.where(func.lower(Person.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:97: in _acquire
    return await self._root.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:864: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:849: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:140: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:132: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:517: in _get_new_connection
    con = await self._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2421: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:1049: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:886: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:931: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:802: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:1070: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:974: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-1929' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/selector_events.py:638: RuntimeError

Check failure on line 221 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_list_as_usr

RuntimeError: Task <Task pending name='Task-1937' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
tilauspalvelu_jwt_user_client = <async_asgi_testclient.testing.TestClient object at 0x7fa22042cc90>

    @pytest.mark.asyncio(loop_scope="session")
    async def test_list_as_usr(tilauspalvelu_jwt_user_client: TestClient) -> None:
        """
        Test - list enrollments as normal user
        """
>       resp = await tilauspalvelu_jwt_user_client.get("/api/v1/enrollment/list")

tests/test_enrollment.py:221: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:313: in get
    return await self.open(*args, method="GET", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:106: in __call__
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:291: in app
    solved_result = await solve_dependencies(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:638: in solve_dependencies
    solved = await call(**solved_result.values)
src/rasenmaeher_api/web/api/middleware/user.py:43: in __call__
    request.state.person = await Person.by_callsign(payload.userid)
src/rasenmaeher_api/db/people.py:258: in by_callsign
    obj = await Person.query.where(func.lower(Person.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:97: in _acquire
    return await self._root.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:864: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:849: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:140: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:132: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:517: in _get_new_connection
    con = await self._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2421: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:1049: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:886: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:931: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:802: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:1070: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:974: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-1937' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/selector_events.py:638: RuntimeError

Check failure on line 299 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_promote_as_usr

RuntimeError: Task <Task pending name='Task-1953' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
tilauspalvelu_jwt_user_client = <async_asgi_testclient.testing.TestClient object at 0x7fa22042cc90>

    @pytest.mark.asyncio(loop_scope="session")
    async def test_promote_as_usr(tilauspalvelu_jwt_user_client: TestClient) -> None:
        """
        Test - promote user, no permissions
        """
        json_dict: Dict[Any, Any] = {"callsign": "superkayra"}
>       resp = await tilauspalvelu_jwt_user_client.post("/api/v1/enrollment/promote", json=json_dict)

tests/test_enrollment.py:299: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:329: in post
    return await self.open(*args, method="POST", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:106: in __call__
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:291: in app
    solved_result = await solve_dependencies(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:638: in solve_dependencies
    solved = await call(**solved_result.values)
src/rasenmaeher_api/web/api/middleware/user.py:43: in __call__
    request.state.person = await Person.by_callsign(payload.userid)
src/rasenmaeher_api/db/people.py:258: in by_callsign
    obj = await Person.query.where(func.lower(Person.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:97: in _acquire
    return await self._root.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:864: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:849: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:140: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:132: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:517: in _get_new_connection
    con = await self._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2421: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:1049: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:886: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:931: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:802: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:1070: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:974: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-1953' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/selector_events.py:638: RuntimeError

Check failure on line 331 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_lock_as_usr

RuntimeError: Task <Task pending name='Task-1961' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
tilauspalvelu_jwt_user_client = <async_asgi_testclient.testing.TestClient object at 0x7fa22042cc90>

    @pytest.mark.asyncio(loop_scope="session")
    async def test_lock_as_usr(tilauspalvelu_jwt_user_client: TestClient) -> None:
        """
        Test - lock as normal use
        """
        json_dict: Dict[Any, Any] = {"callsign": "secondadmin"}
>       resp = await tilauspalvelu_jwt_user_client.post("/api/v1/enrollment/lock", json=json_dict)

tests/test_enrollment.py:331: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:329: in post
    return await self.open(*args, method="POST", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:106: in __call__
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:291: in app
    solved_result = await solve_dependencies(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:638: in solve_dependencies
    solved = await call(**solved_result.values)
src/rasenmaeher_api/web/api/middleware/user.py:43: in __call__
    request.state.person = await Person.by_callsign(payload.userid)
src/rasenmaeher_api/db/people.py:258: in by_callsign
    obj = await Person.query.where(func.lower(Person.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:97: in _acquire
    return await self._root.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:864: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:849: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:140: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:132: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:517: in _get_new_connection
    con = await self._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2421: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:1049: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:886: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:931: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:802: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:1070: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:974: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-1961' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/selector_events.py:638: RuntimeError

Check failure on line 372 in .mypy_cache/3.11/tests/test_enrollment.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit report (local)

test_enrollment.test_accept_as_usr

RuntimeError: Task <Task pending name='Task-1969' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
tilauspalvelu_jwt_user_client = <async_asgi_testclient.testing.TestClient object at 0x7fa22042cc90>

    @pytest.mark.asyncio(loop_scope="session")
    async def test_accept_as_usr(tilauspalvelu_jwt_user_client: TestClient) -> None:
        """
        Test - accept, no permissions -> fail
        """
        json_dict: Dict[Any, Any] = {"callsign": "koira", "approvecode": "nocode"}
>       resp = await tilauspalvelu_jwt_user_client.post("/api/v1/enrollment/accept", json=json_dict)

tests/test_enrollment.py:372: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:329: in post
    return await self.open(*args, method="POST", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
    async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
    async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
    async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
    message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
    raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
    fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
    await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:113: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:187: in __call__
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:165: in __call__
    await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:106: in __call__
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:715: in __call__
    await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:735: in app
    await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:288: in handle
    await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:76: in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
    raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:42: in wrapped_app
    await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:73: in app
    response = await f(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:291: in app
    solved_result = await solve_dependencies(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:638: in solve_dependencies
    solved = await call(**solved_result.values)
src/rasenmaeher_api/web/api/middleware/user.py:43: in __call__
    request.state.person = await Person.by_callsign(payload.userid)
src/rasenmaeher_api/db/people.py:258: in by_callsign
    obj = await Person.query.where(func.lower(Person.callsign) == func.lower(callsign)).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
    return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
    async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
    self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
    await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:97: in _acquire
    return await self._root.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
    return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
    self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
    return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:864: in _acquire
    return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:849: in _acquire_impl
    proxy = await ch.acquire()  # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:140: in acquire
    await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:132: in connect
    self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:517: in _get_new_connection
    con = await self._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2421: in connect
    return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:1049: in _connect
    conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:886: in _connect_addr
    return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:931: in __connect_addr
    tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:802: in _create_ssl_connection
    tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:1070: in create_connection
    sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/base_events.py:974: in _connect_sock
    await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)

    async def sock_connect(self, sock, address):
        """Connect to a remote socket at address.
    
        This method is a coroutine.
        """
        base_events._check_ssl_socket(sock)
        if self._debug and sock.gettimeout() != 0:
            raise ValueError("the socket must be non-blocking")
    
        if sock.family == socket.AF_INET or (
                base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
            resolved = await self._ensure_resolved(
                address, family=sock.family, type=sock.type, proto=sock.proto,
                loop=self,
            )
            _, _, _, _, address = resolved[0]
    
        fut = self.create_future()
        self._sock_connect(fut, sock, address)
        try:
>           return await fut
E           RuntimeError: Task <Task pending name='Task-1969' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(18, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop

/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/asyncio/selector_events.py:638: RuntimeError