Source: pantalaimon
Version: 0.10.5-1
Severity: serious
Tags: ftbfs
Justification: fails to build from source

pantalaimon FTBFS in sid (but could be built successfully in bookworm):

   dh_auto_test -O--buildsystem=pybuild
I: pybuild base:311: cd /build/pantalaimon-0.10.5/.pybuild/cpython3_3.11/build; 
python3.11 -m pytest tests
============================= test session starts ==============================
platform linux -- Python 3.11.9, pytest-8.1.1, pluggy-1.4.0
rootdir: /build/pantalaimon-0.10.5
plugins: Faker-24.4.0
collected 17 items

tests/pan_client_test.py .Fss.                                           [ 29%]
tests/proxy_test.py .E.E.E.E.E                                           [ 58%]
tests/store_test.py E...s..                                              [100%]

==================================== ERRORS ====================================
___________ ERROR at teardown of TestClass.test_daemon_start[pyloop] ___________

self = <pantalaimon.client.PanClient object at 0x7f19b1c17010>
response_class = <class 'nio.responses.SyncResponse'>, method = 'GET'
path = 
'/_matrix/client/r0/sync?access_token=abc123&full_state=true&filter=%7B%22room%22%3A%7B%22state%22%3A%7B%22lazy_load_members%22%3Atrue%7D%7D%7D'
data = None, response_data = None, content_type = None, trace_context = None
data_provider = None, timeout = 0, content_length = None, save_to = None

    async def _send(
        self,
        response_class: Type,
        method: str,
        path: str,
        data: Union[None, str, AsyncDataT] = None,
        response_data: Optional[Tuple[Any, ...]] = None,
        content_type: Optional[str] = None,
        trace_context: Optional[Any] = None,
        data_provider: Optional[DataProvider] = None,
        timeout: Optional[float] = None,
        content_length: Optional[int] = None,
        save_to: Optional[os.PathLike] = None,
    ):
        headers = (
            {"Content-Type": content_type}
            if content_type
            else {"Content-Type": "application/json"}
        )

        if content_length is not None:
            headers["Content-Length"] = str(content_length)

        if self.config.custom_headers is not None:
            headers.update(self.config.custom_headers)

        got_429 = 0
        max_429 = self.config.max_limit_exceeded

        got_timeouts = 0
        max_timeouts = self.config.max_timeouts

        while True:
            if data_provider:
                # mypy expects an "Awaitable[Any]" but data_provider is a
                # method generated during runtime that may or may not be
                # Awaitable. The actual type is a union of the types that we
                # can receive from reading files.
                data = await data_provider(got_429, got_timeouts)  # type: 
ignore

            try:
>               transport_resp = await self.send(
                    method,
                    path,
                    data,
                    headers,
                    trace_context,
                    timeout,
                )

/usr/lib/python3/dist-packages/nio/client/async_client.py:777:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/nio/client/async_client.py:291: in wrapper
    return await func(self, *args, **kwargs)
/usr/lib/python3/dist-packages/nio/client/async_client.py:855: in send
    return await self.client_session.request(
/usr/lib/python3.11/unittest/mock.py:2251: in _execute_mock_call
    result = await effect(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <aioresponses.core.aioresponses object at 0x7f19b1ed3090>
orig_self = <aiohttp.client.ClientSession object at 0x7f19b1c28650>
method = 'GET'
url = 
URL('https://example.org/_matrix/client/r0/sync?access_token=abc123&filter=%257B%2522room%2522%253A%257B%2522state%2522%253A%257B%2522lazy_load_members%2522%253Atrue%257D%257D%257D&full_state=true')
args = ()
kwargs = {'data': None, 'headers': {'Content-Type': 'application/json'}, 'ssl': 
False, 'timeout': 0, ...}
url_origin = 
'https://example.org/_matrix/client/r0/sync?access_token=abc123&full_state=true&filter=%7B%22room%22%3A%7B%22state%22%3A%7B%22lazy_load_members%22%3Atrue%7D%7D%7D'
url_str = 
'https://example.org/_matrix/client/r0/sync?access_token=abc123&filter=%257B%2522room%2522%253A%257B%2522state%2522%253A%257B%2522lazy_load_members%2522%253Atrue%257D%257D%257D&full_state=true'
prefix = 'http://127.0.0.1'
key = ('GET', 
URL('https://example.org/_matrix/client/r0/sync?access_token=abc123&filter=%257B%2522room%2522%253A%257B%2522state%2522%253A%257B%2522lazy_load_members%2522%253Atrue%257D%257D%257D&full_state=true'))
request_call = RequestCall(args=(), kwargs={'data': None, 'ssl': False, 
'headers': {'Content-Type': 'application/json'}, 'trace_request_ctx': None, 
'timeout': 0, 'allow_redirects': True})
response = None

    async def _request_mock(self, orig_self: ClientSession,
                            method: str, url: 'Union[URL, str]',
                            *args: Tuple,
                            **kwargs: Any) -> 'ClientResponse':
        """Return mocked response object or raise connection error."""
        if orig_self.closed:
            raise RuntimeError('Session is closed')

        url_origin = url
        url = normalize_url(merge_params(url, kwargs.get('params')))
        url_str = str(url)
        for prefix in self._passthrough:
            if url_str.startswith(prefix):
                return (await self.patcher.temp_original(
                    orig_self, method, url_origin, *args, **kwargs
                ))

        key = (method, url)
        self.requests.setdefault(key, [])
        request_call = self._build_request_call(method, *args, **kwargs)
        self.requests[key].append(request_call)

        response = await self.match(method, url, **kwargs)

        if response is None:
>           raise ClientConnectionError(
                'Connection refused: {} {}'.format(method, url)
            )
E           aiohttp.client_exceptions.ClientConnectionError: Connection 
refused: GET 
https://example.org/_matrix/client/r0/sync?access_token=abc123&filter=%257B%2522room%2522%253A%257B%2522state%2522%253A%257B%2522lazy_load_members%2522%253Atrue%257D%257D%257D&full_state=true

/usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError

During handling of the above exception, another exception occurred:

    def finalizer():  # type: ignore[no-untyped-def]
        try:
>           return _loop.run_until_complete(gen.__anext__())

/usr/lib/python3/dist-packages/aiohttp/pytest_plugin.py:98:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.11/asyncio/base_events.py:654: in run_until_complete
    return future.result()
tests/conftest.py:155: in pan_proxy_server
    await proxy.shutdown(app)
pantalaimon/daemon.py:1366: in shutdown
    await client.loop_stop()
pantalaimon/client.py:786: in loop_stop
    await self.task
/usr/lib/python3/dist-packages/nio/client/base_client.py:105: in wrapper
    return await func(self, *args, **kwargs)
/usr/lib/python3/dist-packages/nio/client/async_client.py:1300: in sync_forever
    sync_response = await self.sync(
/usr/lib/python3/dist-packages/nio/client/base_client.py:105: in wrapper
    return await func(self, *args, **kwargs)
/usr/lib/python3/dist-packages/nio/client/async_client.py:1173: in sync
    response = await self._send(
/usr/lib/python3/dist-packages/nio/client/async_client.py:821: in _send
    await asyncio.sleep(wait)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

delay = 0.2, result = None

    async def sleep(delay, result=None):
        """Coroutine that completes after a given time (in seconds)."""
        if delay <= 0:
            await __sleep0()
            return result

        loop = events.get_running_loop()
        future = loop.create_future()
        h = loop.call_later(delay,
                            futures._set_result_unless_cancelled,
                            future, result)
        try:
>           return await future
E           asyncio.exceptions.CancelledError

/usr/lib/python3.11/asyncio/tasks.py:649: CancelledError
------------------------------ Captured log call -------------------------------
WARNING  nio.client.async_client:async_client.py:820 Timed out, sleeping for 0s
WARNING  nio.client.async_client:async_client.py:820 Timed out, sleeping for 0s
_________ ERROR at teardown of TestClass.test_pan_client_sync[pyloop] __________

    def finalizer():  # type: ignore[no-untyped-def]
        try:
>           return _loop.run_until_complete(gen.__anext__())

/usr/lib/python3/dist-packages/aiohttp/pytest_plugin.py:98:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.11/asyncio/base_events.py:654: in run_until_complete
    return future.result()
tests/conftest.py:155: in pan_proxy_server
    await proxy.shutdown(app)
pantalaimon/daemon.py:1366: in shutdown
    await client.loop_stop()
pantalaimon/client.py:786: in loop_stop
    await self.task
/usr/lib/python3/dist-packages/nio/client/base_client.py:105: in wrapper
    return await func(self, *args, **kwargs)
/usr/lib/python3/dist-packages/nio/client/async_client.py:1330: in sync_forever
    await self.run_response_callbacks([await response])
/usr/lib/python3.11/asyncio/tasks.py:611: in _wait_for_one
    f = await done.get()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Queue at 0x7f19b0c08b90 maxsize=0 _queue=[<Task cancelled 
name='Task-46' coro=<AsyncClient.keys_upload() done, defined at 
/usr/lib/python3/dist-packages/nio/client/base_client.py:101>>] tasks=1>

    async def get(self):
        """Remove and return an item from the queue.

        If queue is empty, wait until an item is available.
        """
        while self.empty():
            getter = self._get_loop().create_future()
            self._getters.append(getter)
            try:
>               await getter
E               asyncio.exceptions.CancelledError

/usr/lib/python3.11/asyncio/queues.py:158: CancelledError
------------------------------ Captured log call -------------------------------
WARNING  nio.client.async_client:async_client.py:820 Timed out, sleeping for 0s
WARNING  nio.client.async_client:async_client.py:820 Timed out, sleeping for 0s
______ ERROR at teardown of TestClass.test_pan_client_keys_upload[pyloop] ______

    def finalizer():  # type: ignore[no-untyped-def]
        try:
>           return _loop.run_until_complete(gen.__anext__())

/usr/lib/python3/dist-packages/aiohttp/pytest_plugin.py:98:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.11/asyncio/base_events.py:654: in run_until_complete
    return future.result()
tests/conftest.py:155: in pan_proxy_server
    await proxy.shutdown(app)
pantalaimon/daemon.py:1366: in shutdown
    await client.loop_stop()
pantalaimon/client.py:786: in loop_stop
    await self.task
/usr/lib/python3/dist-packages/nio/client/base_client.py:105: in wrapper
    return await func(self, *args, **kwargs)
/usr/lib/python3/dist-packages/nio/client/async_client.py:1340: in sync_forever
    await asyncio.sleep(loop_sleep_time / 1000)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

delay = 0.1, result = None

    async def sleep(delay, result=None):
        """Coroutine that completes after a given time (in seconds)."""
        if delay <= 0:
            await __sleep0()
            return result

        loop = events.get_running_loop()
        future = loop.create_future()
        h = loop.call_later(delay,
                            futures._set_result_unless_cancelled,
                            future, result)
        try:
>           return await future
E           asyncio.exceptions.CancelledError

/usr/lib/python3.11/asyncio/tasks.py:649: CancelledError
_______ ERROR at teardown of TestClass.test_server_users_update[pyloop] ________

self = <pantalaimon.client.PanClient object at 0x7f19b1c40250>
response_class = <class 'nio.responses.SyncResponse'>, method = 'GET'
path = 
'/_matrix/client/r0/sync?access_token=abc123&full_state=true&filter=%7B%22room%22%3A%7B%22state%22%3A%7B%22lazy_load_members%22%3Atrue%7D%7D%7D'
data = None, response_data = None, content_type = None, trace_context = None
data_provider = None, timeout = 0, content_length = None, save_to = None

    async def _send(
        self,
        response_class: Type,
        method: str,
        path: str,
        data: Union[None, str, AsyncDataT] = None,
        response_data: Optional[Tuple[Any, ...]] = None,
        content_type: Optional[str] = None,
        trace_context: Optional[Any] = None,
        data_provider: Optional[DataProvider] = None,
        timeout: Optional[float] = None,
        content_length: Optional[int] = None,
        save_to: Optional[os.PathLike] = None,
    ):
        headers = (
            {"Content-Type": content_type}
            if content_type
            else {"Content-Type": "application/json"}
        )

        if content_length is not None:
            headers["Content-Length"] = str(content_length)

        if self.config.custom_headers is not None:
            headers.update(self.config.custom_headers)

        got_429 = 0
        max_429 = self.config.max_limit_exceeded

        got_timeouts = 0
        max_timeouts = self.config.max_timeouts

        while True:
            if data_provider:
                # mypy expects an "Awaitable[Any]" but data_provider is a
                # method generated during runtime that may or may not be
                # Awaitable. The actual type is a union of the types that we
                # can receive from reading files.
                data = await data_provider(got_429, got_timeouts)  # type: 
ignore

            try:
>               transport_resp = await self.send(
                    method,
                    path,
                    data,
                    headers,
                    trace_context,
                    timeout,
                )

/usr/lib/python3/dist-packages/nio/client/async_client.py:777:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/nio/client/async_client.py:291: in wrapper
    return await func(self, *args, **kwargs)
/usr/lib/python3/dist-packages/nio/client/async_client.py:855: in send
    return await self.client_session.request(
/usr/lib/python3.11/unittest/mock.py:2251: in _execute_mock_call
    result = await effect(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <aioresponses.core.aioresponses object at 0x7f19b11d10d0>
orig_self = <aiohttp.client.ClientSession object at 0x7f19b1c23850>
method = 'GET'
url = 
URL('https://example.org/_matrix/client/r0/sync?access_token=abc123&filter=%257B%2522room%2522%253A%257B%2522state%2522%253A%257B%2522lazy_load_members%2522%253Atrue%257D%257D%257D&full_state=true')
args = ()
kwargs = {'data': None, 'headers': {'Content-Type': 'application/json'}, 'ssl': 
False, 'timeout': 0, ...}
url_origin = 
'https://example.org/_matrix/client/r0/sync?access_token=abc123&full_state=true&filter=%7B%22room%22%3A%7B%22state%22%3A%7B%22lazy_load_members%22%3Atrue%7D%7D%7D'
url_str = 
'https://example.org/_matrix/client/r0/sync?access_token=abc123&filter=%257B%2522room%2522%253A%257B%2522state%2522%253A%257B%2522lazy_load_members%2522%253Atrue%257D%257D%257D&full_state=true'
prefix = 'http://127.0.0.1'
key = ('GET', 
URL('https://example.org/_matrix/client/r0/sync?access_token=abc123&filter=%257B%2522room%2522%253A%257B%2522state%2522%253A%257B%2522lazy_load_members%2522%253Atrue%257D%257D%257D&full_state=true'))
request_call = RequestCall(args=(), kwargs={'data': None, 'ssl': False, 
'headers': {'Content-Type': 'application/json'}, 'trace_request_ctx': None, 
'timeout': 0, 'allow_redirects': True})
response = None

    async def _request_mock(self, orig_self: ClientSession,
                            method: str, url: 'Union[URL, str]',
                            *args: Tuple,
                            **kwargs: Any) -> 'ClientResponse':
        """Return mocked response object or raise connection error."""
        if orig_self.closed:
            raise RuntimeError('Session is closed')

        url_origin = url
        url = normalize_url(merge_params(url, kwargs.get('params')))
        url_str = str(url)
        for prefix in self._passthrough:
            if url_str.startswith(prefix):
                return (await self.patcher.temp_original(
                    orig_self, method, url_origin, *args, **kwargs
                ))

        key = (method, url)
        self.requests.setdefault(key, [])
        request_call = self._build_request_call(method, *args, **kwargs)
        self.requests[key].append(request_call)

        response = await self.match(method, url, **kwargs)

        if response is None:
>           raise ClientConnectionError(
                'Connection refused: {} {}'.format(method, url)
            )
E           aiohttp.client_exceptions.ClientConnectionError: Connection 
refused: GET 
https://example.org/_matrix/client/r0/sync?access_token=abc123&filter=%257B%2522room%2522%253A%257B%2522state%2522%253A%257B%2522lazy_load_members%2522%253Atrue%257D%257D%257D&full_state=true

/usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError

During handling of the above exception, another exception occurred:

    def finalizer():  # type: ignore[no-untyped-def]
        try:
>           return _loop.run_until_complete(gen.__anext__())

/usr/lib/python3/dist-packages/aiohttp/pytest_plugin.py:98:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.11/asyncio/base_events.py:654: in run_until_complete
    return future.result()
tests/conftest.py:155: in pan_proxy_server
    await proxy.shutdown(app)
pantalaimon/daemon.py:1366: in shutdown
    await client.loop_stop()
pantalaimon/client.py:786: in loop_stop
    await self.task
/usr/lib/python3/dist-packages/nio/client/base_client.py:105: in wrapper
    return await func(self, *args, **kwargs)
/usr/lib/python3/dist-packages/nio/client/async_client.py:1300: in sync_forever
    sync_response = await self.sync(
/usr/lib/python3/dist-packages/nio/client/base_client.py:105: in wrapper
    return await func(self, *args, **kwargs)
/usr/lib/python3/dist-packages/nio/client/async_client.py:1173: in sync
    response = await self._send(
/usr/lib/python3/dist-packages/nio/client/async_client.py:821: in _send
    await asyncio.sleep(wait)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

delay = 0.2, result = None

    async def sleep(delay, result=None):
        """Coroutine that completes after a given time (in seconds)."""
        if delay <= 0:
            await __sleep0()
            return result

        loop = events.get_running_loop()
        future = loop.create_future()
        h = loop.call_later(delay,
                            futures._set_result_unless_cancelled,
                            future, result)
        try:
>           return await future
E           asyncio.exceptions.CancelledError

/usr/lib/python3.11/asyncio/tasks.py:649: CancelledError
------------------------------ Captured log setup ------------------------------
WARNING  nio.client.async_client:async_client.py:820 Timed out, sleeping for 0s
WARNING  nio.client.async_client:async_client.py:820 Timed out, sleeping for 0s
______ ERROR at teardown of TestClass.tests_server_devices_update[pyloop] ______

self = <pantalaimon.client.PanClient object at 0x7f19b1198cd0>
response_class = <class 'nio.responses.SyncResponse'>, method = 'GET'
path = 
'/_matrix/client/r0/sync?access_token=abc123&full_state=true&filter=%7B%22room%22%3A%7B%22state%22%3A%7B%22lazy_load_members%22%3Atrue%7D%7D%7D'
data = None, response_data = None, content_type = None, trace_context = None
data_provider = None, timeout = 0, content_length = None, save_to = None

    async def _send(
        self,
        response_class: Type,
        method: str,
        path: str,
        data: Union[None, str, AsyncDataT] = None,
        response_data: Optional[Tuple[Any, ...]] = None,
        content_type: Optional[str] = None,
        trace_context: Optional[Any] = None,
        data_provider: Optional[DataProvider] = None,
        timeout: Optional[float] = None,
        content_length: Optional[int] = None,
        save_to: Optional[os.PathLike] = None,
    ):
        headers = (
            {"Content-Type": content_type}
            if content_type
            else {"Content-Type": "application/json"}
        )

        if content_length is not None:
            headers["Content-Length"] = str(content_length)

        if self.config.custom_headers is not None:
            headers.update(self.config.custom_headers)

        got_429 = 0
        max_429 = self.config.max_limit_exceeded

        got_timeouts = 0
        max_timeouts = self.config.max_timeouts

        while True:
            if data_provider:
                # mypy expects an "Awaitable[Any]" but data_provider is a
                # method generated during runtime that may or may not be
                # Awaitable. The actual type is a union of the types that we
                # can receive from reading files.
                data = await data_provider(got_429, got_timeouts)  # type: 
ignore

            try:
>               transport_resp = await self.send(
                    method,
                    path,
                    data,
                    headers,
                    trace_context,
                    timeout,
                )

/usr/lib/python3/dist-packages/nio/client/async_client.py:777:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/nio/client/async_client.py:291: in wrapper
    return await func(self, *args, **kwargs)
/usr/lib/python3/dist-packages/nio/client/async_client.py:855: in send
    return await self.client_session.request(
/usr/lib/python3.11/unittest/mock.py:2251: in _execute_mock_call
    result = await effect(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <aioresponses.core.aioresponses object at 0x7f19b1130b50>
orig_self = <aiohttp.client.ClientSession object at 0x7f19b119a0d0>
method = 'GET'
url = 
URL('https://example.org/_matrix/client/r0/sync?access_token=abc123&filter=%257B%2522room%2522%253A%257B%2522state%2522%253A%257B%2522lazy_load_members%2522%253Atrue%257D%257D%257D&full_state=true')
args = ()
kwargs = {'data': None, 'headers': {'Content-Type': 'application/json'}, 'ssl': 
False, 'timeout': 0, ...}
url_origin = 
'https://example.org/_matrix/client/r0/sync?access_token=abc123&full_state=true&filter=%7B%22room%22%3A%7B%22state%22%3A%7B%22lazy_load_members%22%3Atrue%7D%7D%7D'
url_str = 
'https://example.org/_matrix/client/r0/sync?access_token=abc123&filter=%257B%2522room%2522%253A%257B%2522state%2522%253A%257B%2522lazy_load_members%2522%253Atrue%257D%257D%257D&full_state=true'
prefix = 'http://127.0.0.1'
key = ('GET', 
URL('https://example.org/_matrix/client/r0/sync?access_token=abc123&filter=%257B%2522room%2522%253A%257B%2522state%2522%253A%257B%2522lazy_load_members%2522%253Atrue%257D%257D%257D&full_state=true'))
request_call = RequestCall(args=(), kwargs={'data': None, 'ssl': False, 
'headers': {'Content-Type': 'application/json'}, 'trace_request_ctx': None, 
'timeout': 0, 'allow_redirects': True})
response = None

    async def _request_mock(self, orig_self: ClientSession,
                            method: str, url: 'Union[URL, str]',
                            *args: Tuple,
                            **kwargs: Any) -> 'ClientResponse':
        """Return mocked response object or raise connection error."""
        if orig_self.closed:
            raise RuntimeError('Session is closed')

        url_origin = url
        url = normalize_url(merge_params(url, kwargs.get('params')))
        url_str = str(url)
        for prefix in self._passthrough:
            if url_str.startswith(prefix):
                return (await self.patcher.temp_original(
                    orig_self, method, url_origin, *args, **kwargs
                ))

        key = (method, url)
        self.requests.setdefault(key, [])
        request_call = self._build_request_call(method, *args, **kwargs)
        self.requests[key].append(request_call)

        response = await self.match(method, url, **kwargs)

        if response is None:
>           raise ClientConnectionError(
                'Connection refused: {} {}'.format(method, url)
            )
E           aiohttp.client_exceptions.ClientConnectionError: Connection 
refused: GET 
https://example.org/_matrix/client/r0/sync?access_token=abc123&filter=%257B%2522room%2522%253A%257B%2522state%2522%253A%257B%2522lazy_load_members%2522%253Atrue%257D%257D%257D&full_state=true

/usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError

During handling of the above exception, another exception occurred:

    def finalizer():  # type: ignore[no-untyped-def]
        try:
>           return _loop.run_until_complete(gen.__anext__())

/usr/lib/python3/dist-packages/aiohttp/pytest_plugin.py:98:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.11/asyncio/base_events.py:654: in run_until_complete
    return future.result()
tests/conftest.py:155: in pan_proxy_server
    await proxy.shutdown(app)
pantalaimon/daemon.py:1366: in shutdown
    await client.loop_stop()
pantalaimon/client.py:786: in loop_stop
    await self.task
/usr/lib/python3/dist-packages/nio/client/base_client.py:105: in wrapper
    return await func(self, *args, **kwargs)
/usr/lib/python3/dist-packages/nio/client/async_client.py:1300: in sync_forever
    sync_response = await self.sync(
/usr/lib/python3/dist-packages/nio/client/base_client.py:105: in wrapper
    return await func(self, *args, **kwargs)
/usr/lib/python3/dist-packages/nio/client/async_client.py:1173: in sync
    response = await self._send(
/usr/lib/python3/dist-packages/nio/client/async_client.py:821: in _send
    await asyncio.sleep(wait)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

delay = 0.2, result = None

    async def sleep(delay, result=None):
        """Coroutine that completes after a given time (in seconds)."""
        if delay <= 0:
            await __sleep0()
            return result

        loop = events.get_running_loop()
        future = loop.create_future()
        h = loop.call_later(delay,
                            futures._set_result_unless_cancelled,
                            future, result)
        try:
>           return await future
E           asyncio.exceptions.CancelledError

/usr/lib/python3.11/asyncio/tasks.py:649: CancelledError
------------------------------ Captured log setup ------------------------------
WARNING  nio.client.async_client:async_client.py:820 Timed out, sleeping for 0s
WARNING  nio.client.async_client:async_client.py:820 Timed out, sleeping for 0s
_______________ ERROR at setup of TestClass.test_account_loading _______________

cls = <class '_pytest.runner.CallInfo'>
func = <function call_and_report.<locals>.<lambda> at 0x7f19b1db68e0>
when = 'setup'
reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)

    @classmethod
    def from_call(
        cls,
        func: Callable[[], TResult],
        when: Literal["collect", "setup", "call", "teardown"],
        reraise: Optional[
            Union[Type[BaseException], Tuple[Type[BaseException], ...]]
        ] = None,
    ) -> "CallInfo[TResult]":
        """Call func, wrapping the result in a CallInfo.

        :param func:
            The function to call. Called without arguments.
        :param when:
            The phase in which the function is called.
        :param reraise:
            Exception or exceptions that shall propagate if raised by the
            function, instead of being wrapped in the CallInfo.
        """
        excinfo = None
        start = timing.time()
        precise_start = timing.perf_counter()
        try:
>           result: Optional[TResult] = func()

/usr/lib/python3/dist-packages/_pytest/runner.py:340:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/_pytest/runner.py:240: in <lambda>
    lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
/usr/lib/python3/dist-packages/pluggy/_hooks.py:501: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, 
firstresult)
/usr/lib/python3/dist-packages/pluggy/_manager.py:119: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/usr/lib/python3/dist-packages/_pytest/unraisableexception.py:85: in 
pytest_runtest_setup
    yield from unraisable_exception_runtest_hook()
/usr/lib/python3/dist-packages/_pytest/unraisableexception.py:65: in 
unraisable_exception_runtest_hook
    yield
/usr/lib/python3/dist-packages/_pytest/logging.py:843: in pytest_runtest_setup
    yield from self._runtest_for(item, "setup")
/usr/lib/python3/dist-packages/_pytest/logging.py:832: in _runtest_for
    yield
/usr/lib/python3/dist-packages/_pytest/capture.py:878: in pytest_runtest_setup
    return (yield)
/usr/lib/python3/dist-packages/_pytest/threadexception.py:82: in 
pytest_runtest_setup
    yield from thread_exception_runtest_hook()
/usr/lib/python3/dist-packages/_pytest/threadexception.py:63: in 
thread_exception_runtest_hook
    yield
/usr/lib/python3/dist-packages/_pytest/runner.py:158: in pytest_runtest_setup
    item.session._setupstate.setup(item)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_pytest.runner.SetupState object at 0x7f19b1d14050>
item = <Function test_account_loading>

    def setup(self, item: Item) -> None:
        """Setup objects along the collector chain to the item."""
        needed_collectors = item.listchain()

        # If a collector fails its setup, fail its entire subtree of items.
        # The setup is not retried for each item - the same exception is used.
        for col, (finalizers, exc) in self.stack.items():
>           assert col in needed_collectors, "previous item was not torn down 
> properly"
E           AssertionError: previous item was not torn down properly

/usr/lib/python3/dist-packages/_pytest/runner.py:503: AssertionError
=================================== FAILURES ===================================
______________________ TestClass.test_start_loop[pyloop] _______________________

self = <pan_client_test.TestClass object at 0x7f19b1d169d0>
client = <pantalaimon.client.PanClient object at 0x7f19b1ecf5d0>
aioresponse = <aioresponses.core.aioresponses object at 0x7f19b1ed40d0>

    async def test_start_loop(self, client, aioresponse):
        sync_url = re.compile(
            r"^https://example\.org/_matrix/client/r0/sync\?access_token=.*";
        )

        aioresponse.get(
            sync_url, status=200, payload=self.initial_sync_response, 
repeat=True
        )

        aioresponse.post(
            
"https://example.org/_matrix/client/r0/keys/upload?access_token=abc123";,
            status=200,
            payload=self.keys_upload_response,
            repeat=True,
        )

        aioresponse.post(
            
"https://example.org/_matrix/client/r0/keys/query?access_token=abc123";,
            status=200,
            payload=self.keys_query_response,
            repeat=True,
        )

        await client.receive_response(self.login_response)

        # Set a big history fetch delay so it doesn't consume the fetch tasks.
        client.pan_conf.history_fetch_delay = 10
        client.start_loop(100)

        # Sync tasks are done after we get a sync event so wait for two of them
        await client.synced.wait()
        await client.synced.wait()

        # Make sure that we have only a single history fetch task for the
        # single room we have
        assert not client.history_fetch_queue.empty()
        assert client.history_fetch_queue.qsize() == 1

        # Do another round to be sure we don't get more tasks than necessary.
        await client.synced.wait()
        assert client.history_fetch_queue.qsize() == 1

>       await client.loop_stop()

tests/pan_client_test.py:372:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pantalaimon/client.py:786: in loop_stop
    await self.task
/usr/lib/python3/dist-packages/nio/client/base_client.py:105: in wrapper
    return await func(self, *args, **kwargs)
/usr/lib/python3/dist-packages/nio/client/async_client.py:1340: in sync_forever
    await asyncio.sleep(loop_sleep_time / 1000)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

delay = 0.1, result = None

    async def sleep(delay, result=None):
        """Coroutine that completes after a given time (in seconds)."""
        if delay <= 0:
            await __sleep0()
            return result

        loop = events.get_running_loop()
        future = loop.create_future()
        h = loop.call_later(delay,
                            futures._set_result_unless_cancelled,
                            future, result)
        try:
>           return await future
E           asyncio.exceptions.CancelledError

/usr/lib/python3.11/asyncio/tasks.py:649: CancelledError
=========================== short test summary info ============================
FAILED tests/pan_client_test.py::TestClass::test_start_loop[pyloop] - asyncio...
ERROR tests/proxy_test.py::TestClass::test_daemon_start[pyloop] - asyncio.exc...
ERROR tests/proxy_test.py::TestClass::test_pan_client_sync[pyloop] - asyncio....
ERROR tests/proxy_test.py::TestClass::test_pan_client_keys_upload[pyloop] - a...
ERROR tests/proxy_test.py::TestClass::test_server_users_update[pyloop] - asyn...
ERROR tests/proxy_test.py::TestClass::tests_server_devices_update[pyloop] - a...
ERROR tests/store_test.py::TestClass::test_account_loading - AssertionError: ...
============== 1 failed, 12 passed, 3 skipped, 6 errors in 3.59s ===============
E: pybuild pybuild:389: test: plugin distutils failed with: exit code=1: cd 
/build/pantalaimon-0.10.5/.pybuild/cpython3_3.11/build; python3.11 -m pytest 
tests
dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p 3.11 
returned exit code 13


Andreas


Reply via email to