#1139346 aiodukeenergy: FTBFS with aiohttp 3.14

#1139346#5
Date:
2026-06-08 23:12:33 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:aiodukeenergy, 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 ...]

status = 200
body = b'{"access_token": "eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJzdWIiOiAiYXV0aDB8VEVTVCIsICJlbWFpbCI6ICJURVNUQEVYQU1QT...RVIiLCAiZXhwIjogMTc4MDk1OTczMH0.ZmFrZV9zaWduYXR1cmU", "internalUserID": "DUKE_TEST_USER", "email": "TEST@EXAMPLE.COM"}'
content_type = 'application/json'
payload = {'access_token': 'eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJzdWIiOiAiYXV0aDB8VEVTVCIsICJlbWFpbCI6ICJURVNUQEVYQU1QTEU...TRVIiLCAiZXhwIjogMTc4MDk1OTczMH0.ZmFrZV9zaWduYXR1cmU', 'email': 'TEST@EXAMPLE.COM', 'internalUserID': 'DUKE_TEST_USER'}
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
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/test_init.py:1064:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
aiodukeenergy/auth0.py:297: in get_user_info
    response = await self.session.get(
<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 0x7fcc54ec3f50>
url = URL('https://login.duke-energy.com/userinfo'), method = 'get'
request_headers = {'Authorization': 'Bearer test_access_token'}, status = 200
body = b'{"email": "test@example.com", "sub": "user123"}'
content_type = 'application/json'
payload = {'email': 'test@example.com', 'sub': 'user123'}, 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
___ TestDukeEnergyAuthTokenManagement.test_duke_token_with_server_issued_at ____

self = <tests.test_init.TestDukeEnergyAuthTokenManagement object at 0x7fcc54cdd370>
mock_auth0_token_response = {'access_token': 'eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJzdWIiOiAiYXV0aDB8VEVTVCIsICJlbWFpbCI6ICJURVNUQEVYQU1QTEU...OTczMCwgImRlX2F1dGgiOiAiZW5jcnlwdGVkX2F1dGhfZGF0YSJ9.ZmFrZV9zaWduYXR1cmU', 'refresh_token': 'refresh_token_value', ...}

    @pytest.mark.asyncio
    async def test_duke_token_with_server_issued_at(self, mock_auth0_token_response):
        """Test Duke token exchange uses server's issued_at timestamp."""
        from aiodukeenergy import Auth0Client, DukeEnergyAuth

        async with aiohttp.ClientSession() as session:
            auth0 = Auth0Client(session)
            auth = DukeEnergyAuth(session, auth0)

            server_issued_at = 1700000000  # Fixed timestamp

            with aioresponses() as mocked:
                # Mock Auth0 token endpoint
                mocked.post(
                    "https://login.duke-energy.com/oauth/token",
                    payload=mock_auth0_token_response,
                )
                # Mock Duke Energy API token exchange with server-provided issued_at
                mocked.post(
                    "https://api-v2.cma.duke-energy.app/login/auth-token",
                    payload={
                        "access_token": "de_token",
                        "expires_in": 1800,
                        "issued_at": server_issued_at,
                    },
                )

tests/test_init.py:1171:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
aiodukeenergy/duke_auth.py:392: in authenticate_with_code
    result = await self._auth0_client.exchange_code(code, code_verifier)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
aiodukeenergy/auth0.py:227: in exchange_code
    response = await self.session.post(
<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 0x7fcc54ec3590>
url = URL('https://login.duke-energy.com/oauth/token'), method = 'post'
request_headers = {'Content-Type': 'application/json; charset=utf-8', 'User-Agent': 'Duke%20Energy/1241 CFNetwork/3860.300.31 Darwin/25....t': 'eyJlbnYiOiB7ImlPUyI6ICIyNi4yIiwgInN3aWZ0IjogIjYueCJ9LCAidmVyc2lvbiI6ICIyLjEzLjAiLCAibmFtZSI6ICJBdXRoMC5zd2lmdCJ9'}
status = 200
body = b'{"access_token": "eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJzdWIiOiAiYXV0aDB8VEVTVCIsICJlbWFpbCI6ICJURVNUQEVYQU1QT...TczMCwgImRlX2F1dGgiOiAiZW5jcnlwdGVkX2F1dGhfZGF0YSJ9.ZmFrZV9zaWduYXR1cmU", "token_type": "Bearer", "expires_in": 86400}'
content_type = 'application/json'
payload = {'access_token': 'eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJzdWIiOiAiYXV0aDB8VEVTVCIsICJlbWFpbCI6ICJURVNUQEVYQU1QTEU...OTczMCwgImRlX2F1dGgiOiAiZW5jcnlwdGVkX2F1dGhfZGF0YSJ9.ZmFrZV9zaWduYXR1cmU', 'refresh_token': 'refresh_token_value', ...}
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
=============================== warnings summary ===============================
tests/test_init.py::TestUtilityFunctions::test_is_token_expired_no_exp_claim
  /usr/lib/python3/dist-packages/jwt/api_jwt.py:147: InsecureKeyLengthWarning: The HMAC key is 6 bytes long, which is below the minimum recommended length of 32 bytes for SHA256. See RFC 7518 Section 3.2.
    return self._jws.encode(