#1139366 pysma: FTBFS with aiohttp 3.14

Package:
src:pysma
Source:
src:pysma
Submitter:
Santiago Vila
Date:
2026-06-10 14:10:06 UTC
Severity:
normal
Tags:
#1139366#5
Date:
2026-06-08 23:13:13 UTC
From:
To:
Dear maintainer:

During a rebuild of all packages in unstable, this package failed to build.

Below you will find the last part of the build log (probably the most
relevant part, but not necessarily). If required, the full build log
is available here:

https://people.debian.org/~sanvila/build-logs/202606/

About the archive rebuild: The build was made on virtual machines from AWS,
using sbuild and a reduced chroot with only build-essential packages.

If you cannot reproduce the bug please contact me privately, as I
am willing to provide ssh access to a virtual machine where the bug is
fully reproducible.

If this is really a bug in one of the build-depends, please use
reassign and add an affects on src:pysma, so that this is still
visible in the BTS web page for this package.

Thanks.
--------------------------------------------------------------------------------
[...]
 debian/rules clean
dh clean --buildsystem=pybuild
   dh_auto_clean -O--buildsystem=pybuild
   dh_autoreconf_clean -O--buildsystem=pybuild
   dh_clean -O--buildsystem=pybuild
 debian/rules binary
dh binary --buildsystem=pybuild
   dh_update_autotools_config -O--buildsystem=pybuild
   dh_autoreconf -O--buildsystem=pybuild
   dh_auto_configure -O--buildsystem=pybuild
   debian/rules override_dh_auto_build
make[1]: Entering directory '/<<PKGBUILDDIR>>'
dh_auto_build override_dh_auto_build --buildsystem=pybuild

[... snipped ...]

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pysma/sma_webconnect.py:438: in get_sensors
    all_sensors = await self._read_all_sensors()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pysma/sma_webconnect.py:427: in _read_all_sensors
    all_values = await self._read_body(URL_ALL_VALUES, {"destDev": []})
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pysma/sma_webconnect.py:248: in _read_body
    await self.new_session()
pysma/sma_webconnect.py:291: in new_session
    body = await self._post_json(URL_LOGIN, self._new_session_data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pysma/sma_webconnect.py:190: in _post_json
    return await self._request_json(hdrs.METH_POST, url, **params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pysma/sma_webconnect.py:124: in _request_json
    async with self.session.request(
/usr/lib/python3/dist-packages/aiohttp/client.py:1683: in __aenter__
    self._resp: _RetType_co = await self._coro
                              ^^^^^^^^^^^^^^^^
<string>:3: in _request
    ???
/usr/lib/python3.13/unittest/mock.py:2332: in _execute_mock_call
    result = await effect(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/aioresponses/core.py:512: in _request_mock
    response = await self.match(method, url, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/aioresponses/core.py:456: in match
    response_or_exc = await matcher.build_response(
/usr/lib/python3/dist-packages/aioresponses/core.py:202: in build_response
    resp = self._build_response(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <aioresponses.core.RequestMatch object at 0x7f4a550a7c50>
url = URL('http://1.1.1.1/dyn/login.json'), method = 'post'
request_headers = {'content-type': 'application/json'}, status = 200
body = b'{"result": {"sid": "ABCD"}}', content_type = 'application/json'
payload = {'result': {'sid': 'ABCD'}}, headers = None
response_class = <class 'aiohttp.client_reqrep.ClientResponse'>, reason = 'OK'

    def _build_response(self, url: 'Union[URL, str]',
                        method: str = hdrs.METH_GET,
                        request_headers: Optional[Dict] = None,
                        status: int = 200,
                        body: Union[str, bytes] = '',
                        content_type: str = 'application/json',
                        payload: Optional[Dict] = None,
                        headers: Optional[Dict] = None,
                        response_class: Optional[Type[ClientResponse]] = None,
                        reason: Optional[str] = None) -> ClientResponse:
        if response_class is None:
            response_class = ClientResponse
        if payload is not None:
            body = json.dumps(payload)
        if not isinstance(body, bytes):
            body = str.encode(body)
        if request_headers is None:
            request_headers = {}
        loop = Mock()
        loop.get_debug = Mock()
        loop.get_debug.return_value = True
        kwargs = {}  # type: Dict[str, Any]
        kwargs['request_info'] = RequestInfo(
            url=url,
            method=method,
            headers=CIMultiDictProxy(CIMultiDict(**request_headers)),
        )
        kwargs['writer'] = None
        kwargs['continue100'] = None
        kwargs['timer'] = TimerNoop()
        kwargs['traces'] = []
        kwargs['loop'] = loop
        kwargs['session'] = None

        # We need to initialize headers manually
        _headers = CIMultiDict({hdrs.CONTENT_TYPE: content_type})
        if headers:
            _headers.update(headers)
        raw_headers = self._build_raw_headers(_headers)
/usr/lib/python3/dist-packages/aioresponses/core.py:171: TypeError
------------------------------ Captured log setup ------------------------------
DEBUG    asyncio:selector_events.py:64 Using selector: EpollSelector
------------------------------ Captured log call -------------------------------
DEBUG    pysma.sma_webconnect:sma_webconnect.py:119 Sending POST request to /dyn/login.json: {'data': '{"right": "usr", "pass": "pass"}', 'headers': {'content-type': 'application/json'}}
_ Test_SMA_class.test_get_sensors[Sunny Boy 1.5, no energy meter, no optimizers] _

self = <tests.test_sma_webconnect.Test_SMA_class object at 0x7f4a54a8ccd0>
get_all_onl_values = {'result': {'012F-7309D11A': {'6100_00411E00': {'val': 1500}, '6100_00411F00': {'val': 0}, '6100_00412000': {'val': 0}, '6100_00416600': {'val': None}, ...}}}
get_all_param_values = {'result': {'012F-7309D11A': {'6322_00851E00': [{'max': 50000, 'min': 5000, 'str': 1, 'val': 6500}], '6322_00851F00': ...': [{'max': 50000, 'min': 5000, 'str': 1, 'val': 50000}], '6800_00822500': {'max': 7000, 'min': 0, 'val': 7000}, ...}}}
number_of_sensors = 32
mock_aioresponse = <aioresponses.core.aioresponses object at 0x7f4a54fb6ed0>

    @pytest.mark.parametrize(
        "get_all_onl_values,get_all_param_values,number_of_sensors", SMA_TESTDATA
    )
    async def test_get_sensors(
        self,
        get_all_onl_values: Callable,
        get_all_param_values: Callable,
        number_of_sensors: int,
        mock_aioresponse: aioresponses,
    ) -> None:
        """Test get_sensors."""
        mock_aioresponse.post(
            f"{self.base_url}/dyn/getAllOnlValues.json?sid=ABCD",
            payload=get_all_onl_values,
            repeat=True,
        )
        mock_aioresponse.post(
            f"{self.base_url}/dyn/getAllParamValues.json?sid=ABCD",
            payload=get_all_param_values,
            repeat=True,
        )

        mock_aioresponse.post(
            f"{self.base_url}/dyn/login.json", payload={"result": {"sid": "ABCD"}}
        )
        mock_aioresponse.post(
            f"{self.base_url}/dyn/getValues.json?sid=ABCD",
            payload={
                "result": {
                    "0199-xxxxx385": {
                        "6180_08214800": {
                            "1": [{"val": [{"tag": "123"}]}],
                        },
                        "6800_008AA300": {
                            "1": [{"val": "0123456"}],
                        },
                        "6800_10852600": {
                            "1": [
                                {"val": "1"},
                                {"val": "2"},
                                {"val": None},
                            ]
                        },
                    }
                }
            },
            repeat=True,
        )

        session = aiohttp.ClientSession()
        sma = SMAWebConnect(session, self.host, "pass")
                   ^^^^^^^^^^^^^^^^^^^^^^^

tests/test_sma_webconnect.py:469:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pysma/sma_webconnect.py:438: in get_sensors
    all_sensors = await self._read_all_sensors()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f4a545182d0>
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f4a54b7dbd0>
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f4a54b7efd0>

pysma/sma_webconnect.py:427: in _read_all_sensors
    all_values = await self._read_body(URL_ALL_VALUES, {"destDev": []})
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pysma/sma_webconnect.py:248: in _read_body
    await self.new_session()
pysma/sma_webconnect.py:291: in new_session
    body = await self._post_json(URL_LOGIN, self._new_session_data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pysma/sma_webconnect.py:190: in _post_json
    return await self._request_json(hdrs.METH_POST, url, **params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pysma/sma_webconnect.py:124: in _request_json
    async with self.session.request(
/usr/lib/python3/dist-packages/aiohttp/client.py:1683: in __aenter__
    self._resp: _RetType_co = await self._coro
                              ^^^^^^^^^^^^^^^^
<string>:3: in _request
    ???
/usr/lib/python3.13/unittest/mock.py:2332: in _execute_mock_call
    result = await effect(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/aioresponses/core.py:512: in _request_mock
    response = await self.match(method, url, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3/dist-packages/aioresponses/core.py:456: in match
    response_or_exc = await matcher.build_response(
/usr/lib/python3/dist-packages/aioresponses/core.py:202: in build_response
    resp = self._build_response(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <aioresponses.core.RequestMatch object at 0x7f4a550a7890>
url = URL('http://1.1.1.1/dyn/login.json'), method = 'post'
request_headers = {'content-type': 'application/json'}, status = 200
body = b'{"result": {"sid": "ABCD"}}', content_type = 'application/json'
payload = {'result': {'sid': 'ABCD'}}, headers = None
response_class = <class 'aiohttp.client_reqrep.ClientResponse'>, reason = 'OK'

    def _build_response(self, url: 'Union[URL, str]',
                        method: str = hdrs.METH_GET,
                        request_headers: Optional[Dict] = None,
                        status: int = 200,
                        body: Union[str, bytes] = '',
                        content_type: str = 'application/json',
                        payload: Optional[Dict] = None,
                        headers: Optional[Dict] = None,
                        response_class: Optional[Type[ClientResponse]] = None,
                        reason: Optional[str] = None) -> ClientResponse:
        if response_class is None:
            response_class = ClientResponse
        if payload is not None:
            body = json.dumps(payload)
        if not isinstance(body, bytes):
            body = str.encode(body)
        if request_headers is None:
            request_headers = {}
        loop = Mock()
        loop.get_debug = Mock()
        loop.get_debug.return_value = True
        kwargs = {}  # type: Dict[str, Any]
        kwargs['request_info'] = RequestInfo(
            url=url,
            method=method,
            headers=CIMultiDictProxy(CIMultiDict(**request_headers)),
        )
        kwargs['writer'] = None
        kwargs['continue100'] = None
        kwargs['timer'] = TimerNoop()
        kwargs['traces'] = []
        kwargs['loop'] = loop
        kwargs['session'] = None

        # We need to initialize headers manually
        _headers = CIMultiDict({hdrs.CONTENT_TYPE: content_type})
        if headers:
            _headers.update(headers)
        raw_headers = self._build_raw_headers(_headers)
/usr/lib/python3/dist-packages/aioresponses/core.py:171: TypeError
------------------------------ Captured log setup ------------------------------
DEBUG    asyncio:selector_events.py:64 Using selector: EpollSelector
------------------------------ Captured log call -------------------------------
DEBUG    pysma.sma_webconnect:sma_webconnect.py:119 Sending POST request to /dyn/login.json: {'data': '{"right": "usr", "pass": "pass"}', 'headers': {'content-type': 'application/json'}}
=============================== warnings summary ===============================
../../../../../../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1581
  /usr/lib/python3/dist-packages/_pytest/config/__init__.py:1581: PytestConfigWarning: No files were found in testpaths; consider removing or adjusting your testpaths configuration. Searching recursively from the current directory instead.
    self.args, self.args_source = self._decide_args(