Source: python-authlib
Version: 1.3.2-1
Severity: normal
User: debian-pyt...@lists.debian.org
Usertags: python3.13
Forwarded: https://github.com/lepture/authlib/issues/679

This package failed build from source when test-built against a version of
python3-defaults that includes 3.13 as a supported version.

To reproduce this issue, build against python3-defaults (python3-all-dev etc.)
from Debian experimental.

What's new in Python 3.13:
https://docs.python.org/3.13/whatsnew/3.13.html

Log snippet:

   debian/rules override_dh_auto_test
make[1]: Entering directory '/<<PKGBUILDDIR>>'
dh_auto_test -- --test-pytest --test-args tests/core
I: pybuild base:311: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_authlib/build; 
python3.13 -m pytest tests/core
============================= test session starts ==============================
platform linux -- Python 3.13.0rc2, pytest-8.3.3, pluggy-1.5.0
rootdir: /<<PKGBUILDDIR>>
configfile: tox.ini
plugins: typeguard-4.3.0, anyio-4.4.0, asyncio-0.20.3, django-4.5.2
asyncio: mode=Mode.AUTO
collected 101 items

tests/core/test_oauth2/test_rfc6749_misc.py ......                       [  5%]
tests/core/test_oauth2/test_rfc7523.py ........................          [ 29%]
tests/core/test_oauth2/test_rfc7591.py ......                            [ 35%]
tests/core/test_oauth2/test_rfc7662.py ......                            [ 41%]
tests/core/test_oauth2/test_rfc8414.py ..........................        [ 67%]
tests/core/test_oidc/test_core.py ..........                             [ 77%]
tests/core/test_oidc/test_discovery.py .......................           [100%]

============================= 101 passed in 1.36s ==============================
I: pybuild base:311: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_authlib/build; 
python3.12 -m pytest tests/core
============================= test session starts ==============================
platform linux -- Python 3.12.6, pytest-8.3.3, pluggy-1.5.0
rootdir: /<<PKGBUILDDIR>>
configfile: tox.ini
plugins: typeguard-4.3.0, anyio-4.4.0, asyncio-0.20.3, django-4.5.2
asyncio: mode=Mode.AUTO
collected 101 items

tests/core/test_oauth2/test_rfc6749_misc.py ......                       [  5%]
tests/core/test_oauth2/test_rfc7523.py ........................          [ 29%]
tests/core/test_oauth2/test_rfc7591.py ......                            [ 35%]
tests/core/test_oauth2/test_rfc7662.py ......                            [ 41%]
tests/core/test_oauth2/test_rfc8414.py ..........................        [ 67%]
tests/core/test_oidc/test_core.py ..........                             [ 77%]
tests/core/test_oidc/test_discovery.py .......................           [100%]

============================= 101 passed in 1.37s ==============================
DJANGO_SETTINGS_MODULE=tests.clients.test_django.settings \
        http_proxy= https_proxy= \
        dh_auto_test -- --test-pytest --test-args tests/clients
I: pybuild base:311: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_authlib/build; 
python3.13 -m pytest tests/clients
============================= test session starts ==============================
platform linux -- Python 3.13.0rc2, pytest-8.3.3, pluggy-1.5.0
django: settings: tests.clients.test_django.settings (from env)
rootdir: /<<PKGBUILDDIR>>
configfile: tox.ini
plugins: typeguard-4.3.0, anyio-4.4.0, asyncio-0.20.3, django-4.5.2
asyncio: mode=Mode.AUTO
collected 169 items

tests/clients/test_django/test_oauth_client.py .............             [  7%]
tests/clients/test_flask/test_oauth_client.py ....................       [ 19%]
tests/clients/test_flask/test_user_mixin.py .....                        [ 22%]
tests/clients/test_httpx/test_assertion_client.py ..                     [ 23%]
tests/clients/test_httpx/test_async_assertion_client.py ..               [ 24%]
tests/clients/test_httpx/test_async_oauth1_client.py .......             [ 28%]
tests/clients/test_httpx/test_async_oauth2_client.py ................... [ 40%]
......                                                                   [ 43%]
tests/clients/test_httpx/test_oauth1_client.py .......                   [ 47%]
tests/clients/test_httpx/test_oauth2_client.py ......................    [ 60%]
tests/clients/test_requests/test_assertion_session.py ..                 [ 62%]
tests/clients/test_requests/test_oauth1_session.py ................      [ 71%]
tests/clients/test_requests/test_oauth2_session.py ..................... [ 84%]
...........                                                              [ 90%]
tests/clients/test_starlette/test_oauth_client.py ............           [ 97%]
tests/clients/test_starlette/test_user_mixin.py ....                     [100%]

=============================== warnings summary ===============================
../../../../../../usr/lib/python3/dist-packages/httpx/_client.py:1426: 2 
warnings
.pybuild/cpython3_3.13_authlib/build/tests/clients/test_httpx/test_async_assertion_client.py:
 3 warnings
.pybuild/cpython3_3.13_authlib/build/tests/clients/test_httpx/test_async_oauth1_client.py:
 7 warnings
.pybuild/cpython3_3.13_authlib/build/tests/clients/test_httpx/test_async_oauth2_client.py:
 24 warnings
.pybuild/cpython3_3.13_authlib/build/tests/clients/test_starlette/test_oauth_client.py:
 11 warnings
.pybuild/cpython3_3.13_authlib/build/tests/clients/test_starlette/test_user_mixin.py:
 2 warnings
  /usr/lib/python3/dist-packages/httpx/_client.py:1426: DeprecationWarning: The 
'app' shortcut is now deprecated. Use the explicit style 
'transport=ASGITransport(app=...)' instead.
    warnings.warn(message, DeprecationWarning)

.pybuild/cpython3_3.13_authlib/build/tests/clients/test_flask/test_oauth_client.py::FlaskOAuthTest::test_openid_authorize
  /<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_authlib/build/authlib/jose/jwk.py:14: 
AuthlibDeprecationWarning: Please use ``JsonWebKey`` directly.
    deprecate('Please use ``JsonWebKey`` directly.')

.pybuild/cpython3_3.13_authlib/build/tests/clients/test_httpx/test_assertion_client.py:
 3 warnings
.pybuild/cpython3_3.13_authlib/build/tests/clients/test_httpx/test_oauth1_client.py:
 7 warnings
.pybuild/cpython3_3.13_authlib/build/tests/clients/test_httpx/test_oauth2_client.py:
 23 warnings
  /usr/lib/python3/dist-packages/httpx/_client.py:680: DeprecationWarning: The 
'app' shortcut is now deprecated. Use the explicit style 
'transport=WSGITransport(app=...)' instead.
    warnings.warn(message, DeprecationWarning)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================= 169 passed, 83 warnings in 1.90s =======================
I: pybuild base:311: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_authlib/build; 
python3.12 -m pytest tests/clients
============================= test session starts ==============================
platform linux -- Python 3.12.6, pytest-8.3.3, pluggy-1.5.0
django: settings: tests.clients.test_django.settings (from env)
rootdir: /<<PKGBUILDDIR>>
configfile: tox.ini
plugins: typeguard-4.3.0, anyio-4.4.0, asyncio-0.20.3, django-4.5.2
asyncio: mode=Mode.AUTO
collected 169 items

tests/clients/test_django/test_oauth_client.py .............             [  7%]
tests/clients/test_flask/test_oauth_client.py ....................       [ 19%]
tests/clients/test_flask/test_user_mixin.py .....                        [ 22%]
tests/clients/test_httpx/test_assertion_client.py ..                     [ 23%]
tests/clients/test_httpx/test_async_assertion_client.py ..               [ 24%]
tests/clients/test_httpx/test_async_oauth1_client.py .......             [ 28%]
tests/clients/test_httpx/test_async_oauth2_client.py ................... [ 40%]
......                                                                   [ 43%]
tests/clients/test_httpx/test_oauth1_client.py .......                   [ 47%]
tests/clients/test_httpx/test_oauth2_client.py ......................    [ 60%]
tests/clients/test_requests/test_assertion_session.py ..                 [ 62%]
tests/clients/test_requests/test_oauth1_session.py ................      [ 71%]
tests/clients/test_requests/test_oauth2_session.py ..................... [ 84%]
...........                                                              [ 90%]
tests/clients/test_starlette/test_oauth_client.py ............           [ 97%]
tests/clients/test_starlette/test_user_mixin.py ....                     [100%]

=============================== warnings summary ===============================
../../../../../../usr/lib/python3/dist-packages/httpx/_client.py:1426: 2 
warnings
.pybuild/cpython3_3.12_authlib/build/tests/clients/test_httpx/test_async_assertion_client.py:
 3 warnings
.pybuild/cpython3_3.12_authlib/build/tests/clients/test_httpx/test_async_oauth1_client.py:
 7 warnings
.pybuild/cpython3_3.12_authlib/build/tests/clients/test_httpx/test_async_oauth2_client.py:
 24 warnings
.pybuild/cpython3_3.12_authlib/build/tests/clients/test_starlette/test_oauth_client.py:
 11 warnings
.pybuild/cpython3_3.12_authlib/build/tests/clients/test_starlette/test_user_mixin.py:
 2 warnings
  /usr/lib/python3/dist-packages/httpx/_client.py:1426: DeprecationWarning: The 
'app' shortcut is now deprecated. Use the explicit style 
'transport=ASGITransport(app=...)' instead.
    warnings.warn(message, DeprecationWarning)

.pybuild/cpython3_3.12_authlib/build/tests/clients/test_flask/test_oauth_client.py::FlaskOAuthTest::test_openid_authorize
  /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_authlib/build/authlib/jose/jwk.py:14: 
AuthlibDeprecationWarning: Please use ``JsonWebKey`` directly.
    deprecate('Please use ``JsonWebKey`` directly.')

.pybuild/cpython3_3.12_authlib/build/tests/clients/test_httpx/test_assertion_client.py:
 3 warnings
.pybuild/cpython3_3.12_authlib/build/tests/clients/test_httpx/test_oauth1_client.py:
 7 warnings
.pybuild/cpython3_3.12_authlib/build/tests/clients/test_httpx/test_oauth2_client.py:
 23 warnings
  /usr/lib/python3/dist-packages/httpx/_client.py:680: DeprecationWarning: The 
'app' shortcut is now deprecated. Use the explicit style 
'transport=WSGITransport(app=...)' instead.
    warnings.warn(message, DeprecationWarning)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================= 169 passed, 83 warnings in 1.90s =======================
DJANGO_SETTINGS_MODULE=tests.django.settings \
        dh_auto_test -- --test-pytest --test-args tests/django
I: pybuild base:311: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_authlib/build; 
python3.13 -m pytest tests/django
============================= test session starts ==============================
platform linux -- Python 3.13.0rc2, pytest-8.3.3, pluggy-1.5.0
django: settings: tests.django.settings (from env)
rootdir: /<<PKGBUILDDIR>>
configfile: tox.ini
plugins: typeguard-4.3.0, anyio-4.4.0, asyncio-0.20.3, django-4.5.2
asyncio: mode=Mode.AUTO
collected 48 items

tests/django/test_oauth1/test_authorize.py ....                          [  8%]
tests/django/test_oauth1/test_resource_protector.py ....                 [ 16%]
tests/django/test_oauth1/test_token_credentials.py .....                 [ 27%]
tests/django/test_oauth2/test_authorization_code_grant.py .......        [ 41%]
tests/django/test_oauth2/test_client_credentials_grant.py .....          [ 52%]
tests/django/test_oauth2/test_implicit_grant.py ...                      [ 58%]
tests/django/test_oauth2/test_password_grant.py .....                    [ 68%]
tests/django/test_oauth2/test_refresh_token.py ......                    [ 81%]
tests/django/test_oauth2/test_resource_protector.py .....                [ 91%]
tests/django/test_oauth2/test_revocation_endpoint.py ....                [100%]

============================== 48 passed in 2.87s ==============================
I: pybuild base:311: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_authlib/build; 
python3.12 -m pytest tests/django
============================= test session starts ==============================
platform linux -- Python 3.12.6, pytest-8.3.3, pluggy-1.5.0
django: settings: tests.django.settings (from env)
rootdir: /<<PKGBUILDDIR>>
configfile: tox.ini
plugins: typeguard-4.3.0, anyio-4.4.0, asyncio-0.20.3, django-4.5.2
asyncio: mode=Mode.AUTO
collected 48 items

tests/django/test_oauth1/test_authorize.py ....                          [  8%]
tests/django/test_oauth1/test_resource_protector.py ....                 [ 16%]
tests/django/test_oauth1/test_token_credentials.py .....                 [ 27%]
tests/django/test_oauth2/test_authorization_code_grant.py .......        [ 41%]
tests/django/test_oauth2/test_client_credentials_grant.py .....          [ 52%]
tests/django/test_oauth2/test_implicit_grant.py ...                      [ 58%]
tests/django/test_oauth2/test_password_grant.py .....                    [ 68%]
tests/django/test_oauth2/test_refresh_token.py ......                    [ 81%]
tests/django/test_oauth2/test_resource_protector.py .....                [ 91%]
tests/django/test_oauth2/test_revocation_endpoint.py ....                [100%]

============================== 48 passed in 2.86s ==============================
dh_auto_test -- --test-pytest --test-args tests/flask
I: pybuild base:311: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_authlib/build; 
python3.13 -m pytest tests/flask
============================= test session starts ==============================
platform linux -- Python 3.13.0rc2, pytest-8.3.3, pluggy-1.5.0
rootdir: /<<PKGBUILDDIR>>
configfile: tox.ini
plugins: typeguard-4.3.0, anyio-4.4.0, asyncio-0.20.3, django-4.5.2
asyncio: mode=Mode.AUTO
collected 212 items

tests/flask/test_oauth1/test_authorize.py ......                         [  2%]
tests/flask/test_oauth1/test_resource_protector.py ........              [  6%]
tests/flask/test_oauth1/test_temporary_credentials.py ................   [ 14%]
tests/flask/test_oauth1/test_token_credentials.py ......                 [ 16%]
tests/flask/test_oauth2/test_authorization_code_grant.py .............   [ 23%]
tests/flask/test_oauth2/test_client_configuration_endpoint.py .......... [ 27%]
........                                                                 [ 31%]
tests/flask/test_oauth2/test_client_credentials_grant.py .....           [ 33%]
tests/flask/test_oauth2/test_client_registration_endpoint.py .........   [ 38%]
tests/flask/test_oauth2/test_code_challenge.py .............             [ 44%]
tests/flask/test_oauth2/test_device_code_grant.py .........              [ 48%]
tests/flask/test_oauth2/test_implicit_grant.py ......                    [ 51%]
tests/flask/test_oauth2/test_introspection_endpoint.py ....              [ 53%]
tests/flask/test_oauth2/test_jwt_access_token.py ..s.FFF........FF...... [ 64%]
.......                                                                  [ 67%]
tests/flask/test_oauth2/test_jwt_bearer_client_auth.py .......           [ 70%]
tests/flask/test_oauth2/test_jwt_bearer_grant.py ......                  [ 73%]
tests/flask/test_oauth2/test_oauth2_server.py .......                    [ 76%]
tests/flask/test_oauth2/test_openid_code_grant.py ........               [ 80%]
tests/flask/test_oauth2/test_openid_hybrid_grant.py ..........           [ 85%]
tests/flask/test_oauth2/test_openid_implict_grant.py ........            [ 89%]
tests/flask/test_oauth2/test_password_grant.py ........                  [ 92%]
tests/flask/test_oauth2/test_refresh_token.py ..........                 [ 97%]
tests/flask/test_oauth2/test_revocation_endpoint.py .....                [100%]

=================================== FAILURES ===================================
____________ JWTAccessTokenResourceServerTest.test_access_resource _____________

self = 
<tests.flask.test_oauth2.test_jwt_access_token.JWTAccessTokenResourceServerTest 
testMethod=test_access_resource>

    def test_access_resource(self):
        headers = {'Authorization': f'Bearer {self.access_token}'}
    
>       rv = self.client.get('/protected', headers=headers)

tests/flask/test_oauth2/test_jwt_access_token.py:400: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3/dist-packages/werkzeug/test.py:1162: in get
    return self.open(*args, **kw)
/usr/lib/python3/dist-packages/flask/testing.py:235: in open
    response = super().open(
/usr/lib/python3/dist-packages/werkzeug/test.py:1116: in open
    response_parts = self.run_wsgi_app(request.environ, buffered=buffered)
/usr/lib/python3/dist-packages/werkzeug/test.py:988: in run_wsgi_app
    rv = run_wsgi_app(self.application, environ, buffered=buffered)
/usr/lib/python3/dist-packages/werkzeug/test.py:1264: in run_wsgi_app
    app_rv = app(environ, start_response)
/usr/lib/python3/dist-packages/flask/app.py:1498: in __call__
    return self.wsgi_app(environ, start_response)
/usr/lib/python3/dist-packages/flask/app.py:1476: in wsgi_app
    response = self.handle_exception(e)
/usr/lib/python3/dist-packages/flask/app.py:1473: in wsgi_app
    response = self.full_dispatch_request()
/usr/lib/python3/dist-packages/flask/app.py:882: in full_dispatch_request
    rv = self.handle_user_exception(e)
/usr/lib/python3/dist-packages/flask/app.py:880: in full_dispatch_request
    rv = self.dispatch_request()
/usr/lib/python3/dist-packages/flask/app.py:865: in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # 
type: ignore[no-any-return]
authlib/integrations/flask_oauth2/resource_protector.py:105: in decorated
    return f(*args, **kwargs)
tests/flask/test_oauth2/test_jwt_access_token.py:52: in protected
    return jsonify(id=user.id, username=user.username, token=current_token)
/usr/lib/python3/dist-packages/flask/json/__init__.py:170: in jsonify
    return current_app.json.response(*args, **kwargs)  # type: 
ignore[return-value]
/usr/lib/python3/dist-packages/flask/json/provider.py:214: in response
    f"{self.dumps(obj, **dump_args)}\n", mimetype=self.mimetype
/usr/lib/python3/dist-packages/flask/json/provider.py:179: in dumps
    return json.dumps(obj, **kwargs)
/usr/lib/python3.13/json/__init__.py:238: in dumps
    **kw).encode(obj)
/usr/lib/python3.13/json/encoder.py:200: in encode
    chunks = self.iterencode(o, _one_shot=True)
/usr/lib/python3.13/json/encoder.py:261: in iterencode
    return _iterencode(o, 0)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

o = <LocalProxy unbound>

    def _default(o: t.Any) -> t.Any:
        if isinstance(o, date):
            return http_date(o)
    
        if isinstance(o, (decimal.Decimal, uuid.UUID)):
            return str(o)
    
        if dataclasses and dataclasses.is_dataclass(o):
            return dataclasses.asdict(o)
    
        if hasattr(o, "__html__"):
            return str(o.__html__())
    
>       raise TypeError(f"Object of type {type(o).__name__} is not JSON 
> serializable")
E       TypeError: Object of type LocalProxy is not JSON serializable

/usr/lib/python3/dist-packages/flask/json/provider.py:121: TypeError
________ JWTAccessTokenResourceServerTest.test_entitlements_restriction ________

self = 
<tests.flask.test_oauth2.test_jwt_access_token.JWTAccessTokenResourceServerTest 
testMethod=test_entitlements_restriction>

    def test_entitlements_restriction(self):
        '''
        Many authorization servers embed authorization attributes that go 
beyond the
        delegated scenarios described by [RFC7519] in the access tokens they 
issue.
        Typical examples include resource owner memberships in roles and groups 
that
        are relevant to the resource being accessed, entitlements assigned to 
the
        resource owner for the targeted resource that the authorization server 
knows
        about, and so on. An authorization server wanting to include such 
attributes
        in a JWT access token SHOULD use the 'groups', 'roles', and 
'entitlements'
        attributes of the 'User' resource schema defined by Section 4.1.2 of
        [RFC7643]) as claim types.
        '''
    
        for claim in ['groups', 'roles', 'entitlements']:
            claims = create_access_token_claims(
                self.oauth_client, self.user, self.issuer
            )
            claims[claim] = ['invalid']
            access_token = create_access_token(claims, self.jwks)
    
            headers = {'Authorization': f'Bearer {access_token}'}
>           rv = self.client.get('/protected', headers=headers)

tests/flask/test_oauth2/test_jwt_access_token.py:551: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3/dist-packages/werkzeug/test.py:1162: in get
    return self.open(*args, **kw)
/usr/lib/python3/dist-packages/flask/testing.py:235: in open
    response = super().open(
/usr/lib/python3/dist-packages/werkzeug/test.py:1116: in open
    response_parts = self.run_wsgi_app(request.environ, buffered=buffered)
/usr/lib/python3/dist-packages/werkzeug/test.py:988: in run_wsgi_app
    rv = run_wsgi_app(self.application, environ, buffered=buffered)
/usr/lib/python3/dist-packages/werkzeug/test.py:1264: in run_wsgi_app
    app_rv = app(environ, start_response)
/usr/lib/python3/dist-packages/flask/app.py:1498: in __call__
    return self.wsgi_app(environ, start_response)
/usr/lib/python3/dist-packages/flask/app.py:1476: in wsgi_app
    response = self.handle_exception(e)
/usr/lib/python3/dist-packages/flask/app.py:1473: in wsgi_app
    response = self.full_dispatch_request()
/usr/lib/python3/dist-packages/flask/app.py:882: in full_dispatch_request
    rv = self.handle_user_exception(e)
/usr/lib/python3/dist-packages/flask/app.py:880: in full_dispatch_request
    rv = self.dispatch_request()
/usr/lib/python3/dist-packages/flask/app.py:865: in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # 
type: ignore[no-any-return]
authlib/integrations/flask_oauth2/resource_protector.py:105: in decorated
    return f(*args, **kwargs)
tests/flask/test_oauth2/test_jwt_access_token.py:52: in protected
    return jsonify(id=user.id, username=user.username, token=current_token)
/usr/lib/python3/dist-packages/flask/json/__init__.py:170: in jsonify
    return current_app.json.response(*args, **kwargs)  # type: 
ignore[return-value]
/usr/lib/python3/dist-packages/flask/json/provider.py:214: in response
    f"{self.dumps(obj, **dump_args)}\n", mimetype=self.mimetype
/usr/lib/python3/dist-packages/flask/json/provider.py:179: in dumps
    return json.dumps(obj, **kwargs)
/usr/lib/python3.13/json/__init__.py:238: in dumps
    **kw).encode(obj)
/usr/lib/python3.13/json/encoder.py:200: in encode
    chunks = self.iterencode(o, _one_shot=True)
/usr/lib/python3.13/json/encoder.py:261: in iterencode
    return _iterencode(o, 0)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

o = <LocalProxy unbound>

    def _default(o: t.Any) -> t.Any:
        if isinstance(o, date):
            return http_date(o)
    
        if isinstance(o, (decimal.Decimal, uuid.UUID)):
            return str(o)
    
        if dataclasses and dataclasses.is_dataclass(o):
            return dataclasses.asdict(o)
    
        if hasattr(o, "__html__"):
            return str(o.__html__())
    
>       raise TypeError(f"Object of type {type(o).__name__} is not JSON 
> serializable")
E       TypeError: Object of type LocalProxy is not JSON serializable

/usr/lib/python3/dist-packages/flask/json/provider.py:121: TypeError
____________ JWTAccessTokenResourceServerTest.test_extra_attributes ____________

self = 
<tests.flask.test_oauth2.test_jwt_access_token.JWTAccessTokenResourceServerTest 
testMethod=test_extra_attributes>

    def test_extra_attributes(self):
        '''
        Authorization servers MAY return arbitrary attributes not defined in any
        existing specification, as long as the corresponding claim names are 
collision
        resistant or the access tokens are meant to be used only within a 
private
        subsystem. Please refer to Sections 4.2 and 4.3 of [RFC7519] for 
details.
        '''
    
        self.claims['email'] = 'u...@example.org'
        access_token = create_access_token(self.claims, self.jwks)
    
        headers = {'Authorization': f'Bearer {access_token}'}
>       rv = self.client.get('/protected', headers=headers)

tests/flask/test_oauth2/test_jwt_access_token.py:571: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3/dist-packages/werkzeug/test.py:1162: in get
    return self.open(*args, **kw)
/usr/lib/python3/dist-packages/flask/testing.py:235: in open
    response = super().open(
/usr/lib/python3/dist-packages/werkzeug/test.py:1116: in open
    response_parts = self.run_wsgi_app(request.environ, buffered=buffered)
/usr/lib/python3/dist-packages/werkzeug/test.py:988: in run_wsgi_app
    rv = run_wsgi_app(self.application, environ, buffered=buffered)
/usr/lib/python3/dist-packages/werkzeug/test.py:1264: in run_wsgi_app
    app_rv = app(environ, start_response)
/usr/lib/python3/dist-packages/flask/app.py:1498: in __call__
    return self.wsgi_app(environ, start_response)
/usr/lib/python3/dist-packages/flask/app.py:1476: in wsgi_app
    response = self.handle_exception(e)
/usr/lib/python3/dist-packages/flask/app.py:1473: in wsgi_app
    response = self.full_dispatch_request()
/usr/lib/python3/dist-packages/flask/app.py:882: in full_dispatch_request
    rv = self.handle_user_exception(e)
/usr/lib/python3/dist-packages/flask/app.py:880: in full_dispatch_request
    rv = self.dispatch_request()
/usr/lib/python3/dist-packages/flask/app.py:865: in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # 
type: ignore[no-any-return]
authlib/integrations/flask_oauth2/resource_protector.py:105: in decorated
    return f(*args, **kwargs)
tests/flask/test_oauth2/test_jwt_access_token.py:52: in protected
    return jsonify(id=user.id, username=user.username, token=current_token)
/usr/lib/python3/dist-packages/flask/json/__init__.py:170: in jsonify
    return current_app.json.response(*args, **kwargs)  # type: 
ignore[return-value]
/usr/lib/python3/dist-packages/flask/json/provider.py:214: in response
    f"{self.dumps(obj, **dump_args)}\n", mimetype=self.mimetype
/usr/lib/python3/dist-packages/flask/json/provider.py:179: in dumps
    return json.dumps(obj, **kwargs)
/usr/lib/python3.13/json/__init__.py:238: in dumps
    **kw).encode(obj)
/usr/lib/python3.13/json/encoder.py:200: in encode
    chunks = self.iterencode(o, _one_shot=True)
/usr/lib/python3.13/json/encoder.py:261: in iterencode
    return _iterencode(o, 0)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

o = <LocalProxy unbound>

    def _default(o: t.Any) -> t.Any:
        if isinstance(o, date):
            return http_date(o)
    
        if isinstance(o, (decimal.Decimal, uuid.UUID)):
            return str(o)
    
        if dataclasses and dataclasses.is_dataclass(o):
            return dataclasses.asdict(o)
    
        if hasattr(o, "__html__"):
            return str(o.__html__())
    
>       raise TypeError(f"Object of type {type(o).__name__} is not JSON 
> serializable")
E       TypeError: Object of type LocalProxy is not JSON serializable

/usr/lib/python3/dist-packages/flask/json/provider.py:121: TypeError
___________ JWTAccessTokenResourceServerTest.test_scope_restriction ____________

self = 
<tests.flask.test_oauth2.test_jwt_access_token.JWTAccessTokenResourceServerTest 
testMethod=test_scope_restriction>

    def test_scope_restriction(self):
        '''
        If an authorization request includes a scope parameter, the 
corresponding
        issued JWT access token SHOULD include a 'scope' claim as defined in 
Section
        4.2 of [RFC8693]. All the individual scope strings in the 'scope' claim 
MUST
        have meaning for the resources indicated in the 'aud' claim. See 
Section 5 for
        more considerations about the relationship between scope strings and 
resources
        indicated by the 'aud' claim.
        '''
    
        self.claims['scope'] = ['invalid-scope']
        access_token = create_access_token(self.claims, self.jwks)
    
        headers = {'Authorization': f'Bearer {access_token}'}
>       rv = self.client.get('/protected', headers=headers)

tests/flask/test_oauth2/test_jwt_access_token.py:522: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3/dist-packages/werkzeug/test.py:1162: in get
    return self.open(*args, **kw)
/usr/lib/python3/dist-packages/flask/testing.py:235: in open
    response = super().open(
/usr/lib/python3/dist-packages/werkzeug/test.py:1116: in open
    response_parts = self.run_wsgi_app(request.environ, buffered=buffered)
/usr/lib/python3/dist-packages/werkzeug/test.py:988: in run_wsgi_app
    rv = run_wsgi_app(self.application, environ, buffered=buffered)
/usr/lib/python3/dist-packages/werkzeug/test.py:1264: in run_wsgi_app
    app_rv = app(environ, start_response)
/usr/lib/python3/dist-packages/flask/app.py:1498: in __call__
    return self.wsgi_app(environ, start_response)
/usr/lib/python3/dist-packages/flask/app.py:1476: in wsgi_app
    response = self.handle_exception(e)
/usr/lib/python3/dist-packages/flask/app.py:1473: in wsgi_app
    response = self.full_dispatch_request()
/usr/lib/python3/dist-packages/flask/app.py:882: in full_dispatch_request
    rv = self.handle_user_exception(e)
/usr/lib/python3/dist-packages/flask/app.py:880: in full_dispatch_request
    rv = self.dispatch_request()
/usr/lib/python3/dist-packages/flask/app.py:865: in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # 
type: ignore[no-any-return]
authlib/integrations/flask_oauth2/resource_protector.py:105: in decorated
    return f(*args, **kwargs)
tests/flask/test_oauth2/test_jwt_access_token.py:52: in protected
    return jsonify(id=user.id, username=user.username, token=current_token)
/usr/lib/python3/dist-packages/flask/json/__init__.py:170: in jsonify
    return current_app.json.response(*args, **kwargs)  # type: 
ignore[return-value]
/usr/lib/python3/dist-packages/flask/json/provider.py:214: in response
    f"{self.dumps(obj, **dump_args)}\n", mimetype=self.mimetype
/usr/lib/python3/dist-packages/flask/json/provider.py:179: in dumps
    return json.dumps(obj, **kwargs)
/usr/lib/python3.13/json/__init__.py:238: in dumps
    **kw).encode(obj)
/usr/lib/python3.13/json/encoder.py:200: in encode
    chunks = self.iterencode(o, _one_shot=True)
/usr/lib/python3.13/json/encoder.py:261: in iterencode
    return _iterencode(o, 0)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

o = <LocalProxy unbound>

    def _default(o: t.Any) -> t.Any:
        if isinstance(o, date):
            return http_date(o)
    
        if isinstance(o, (decimal.Decimal, uuid.UUID)):
            return str(o)
    
        if dataclasses and dataclasses.is_dataclass(o):
            return dataclasses.asdict(o)
    
        if hasattr(o, "__html__"):
            return str(o.__html__())
    
>       raise TypeError(f"Object of type {type(o).__name__} is not JSON 
> serializable")
E       TypeError: Object of type LocalProxy is not JSON serializable

/usr/lib/python3/dist-packages/flask/json/provider.py:121: TypeError
__________________ JWTAccessTokenResourceServerTest.test_typ ___________________

self = 
<tests.flask.test_oauth2.test_jwt_access_token.JWTAccessTokenResourceServerTest 
testMethod=test_typ>

    def test_typ(self):
        '''
        The resource server MUST verify that the 'typ' header value is 'at+jwt' 
or
        'application/at+jwt' and reject tokens carrying any other value.
        '''
        access_token = create_access_token(self.claims, self.jwks, typ='at+jwt')
    
        headers = {'Authorization': f'Bearer {access_token}'}
>       rv = self.client.get('/protected', headers=headers)

tests/flask/test_oauth2/test_jwt_access_token.py:432: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3/dist-packages/werkzeug/test.py:1162: in get
    return self.open(*args, **kw)
/usr/lib/python3/dist-packages/flask/testing.py:235: in open
    response = super().open(
/usr/lib/python3/dist-packages/werkzeug/test.py:1116: in open
    response_parts = self.run_wsgi_app(request.environ, buffered=buffered)
/usr/lib/python3/dist-packages/werkzeug/test.py:988: in run_wsgi_app
    rv = run_wsgi_app(self.application, environ, buffered=buffered)
/usr/lib/python3/dist-packages/werkzeug/test.py:1264: in run_wsgi_app
    app_rv = app(environ, start_response)
/usr/lib/python3/dist-packages/flask/app.py:1498: in __call__
    return self.wsgi_app(environ, start_response)
/usr/lib/python3/dist-packages/flask/app.py:1476: in wsgi_app
    response = self.handle_exception(e)
/usr/lib/python3/dist-packages/flask/app.py:1473: in wsgi_app
    response = self.full_dispatch_request()
/usr/lib/python3/dist-packages/flask/app.py:882: in full_dispatch_request
    rv = self.handle_user_exception(e)
/usr/lib/python3/dist-packages/flask/app.py:880: in full_dispatch_request
    rv = self.dispatch_request()
/usr/lib/python3/dist-packages/flask/app.py:865: in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # 
type: ignore[no-any-return]
authlib/integrations/flask_oauth2/resource_protector.py:105: in decorated
    return f(*args, **kwargs)
tests/flask/test_oauth2/test_jwt_access_token.py:52: in protected
    return jsonify(id=user.id, username=user.username, token=current_token)
/usr/lib/python3/dist-packages/flask/json/__init__.py:170: in jsonify
    return current_app.json.response(*args, **kwargs)  # type: 
ignore[return-value]
/usr/lib/python3/dist-packages/flask/json/provider.py:214: in response
    f"{self.dumps(obj, **dump_args)}\n", mimetype=self.mimetype
/usr/lib/python3/dist-packages/flask/json/provider.py:179: in dumps
    return json.dumps(obj, **kwargs)
/usr/lib/python3.13/json/__init__.py:238: in dumps
    **kw).encode(obj)
/usr/lib/python3.13/json/encoder.py:200: in encode
    chunks = self.iterencode(o, _one_shot=True)
/usr/lib/python3.13/json/encoder.py:261: in iterencode
    return _iterencode(o, 0)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

o = <LocalProxy unbound>

    def _default(o: t.Any) -> t.Any:
        if isinstance(o, date):
            return http_date(o)
    
        if isinstance(o, (decimal.Decimal, uuid.UUID)):
            return str(o)
    
        if dataclasses and dataclasses.is_dataclass(o):
            return dataclasses.asdict(o)
    
        if hasattr(o, "__html__"):
            return str(o.__html__())
    
>       raise TypeError(f"Object of type {type(o).__name__} is not JSON 
> serializable")
E       TypeError: Object of type LocalProxy is not JSON serializable

/usr/lib/python3/dist-packages/flask/json/provider.py:121: TypeError
=========================== short test summary info ============================
FAILED 
tests/flask/test_oauth2/test_jwt_access_token.py::JWTAccessTokenResourceServerTest::test_access_resource
FAILED 
tests/flask/test_oauth2/test_jwt_access_token.py::JWTAccessTokenResourceServerTest::test_entitlements_restriction
FAILED 
tests/flask/test_oauth2/test_jwt_access_token.py::JWTAccessTokenResourceServerTest::test_extra_attributes
FAILED 
tests/flask/test_oauth2/test_jwt_access_token.py::JWTAccessTokenResourceServerTest::test_scope_restriction
FAILED 
tests/flask/test_oauth2/test_jwt_access_token.py::JWTAccessTokenResourceServerTest::test_typ
================== 5 failed, 206 passed, 1 skipped in 20.01s ===================
E: pybuild pybuild:389: test: plugin pyproject failed with: exit code=1: cd 
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.13_authlib/build; python3.13 -m pytest 
tests/flask
I: pybuild base:311: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_authlib/build; 
python3.12 -m pytest tests/flask
============================= test session starts ==============================
platform linux -- Python 3.12.6, pytest-8.3.3, pluggy-1.5.0
rootdir: /<<PKGBUILDDIR>>
configfile: tox.ini
plugins: typeguard-4.3.0, anyio-4.4.0, asyncio-0.20.3, django-4.5.2
asyncio: mode=Mode.AUTO
collected 212 items

tests/flask/test_oauth1/test_authorize.py ......                         [  2%]
tests/flask/test_oauth1/test_resource_protector.py ........              [  6%]
tests/flask/test_oauth1/test_temporary_credentials.py ................   [ 14%]
tests/flask/test_oauth1/test_token_credentials.py ......                 [ 16%]
tests/flask/test_oauth2/test_authorization_code_grant.py .............   [ 23%]
tests/flask/test_oauth2/test_client_configuration_endpoint.py .......... [ 27%]
........                                                                 [ 31%]
tests/flask/test_oauth2/test_client_credentials_grant.py .....           [ 33%]
tests/flask/test_oauth2/test_client_registration_endpoint.py .........   [ 38%]
tests/flask/test_oauth2/test_code_challenge.py .............             [ 44%]
tests/flask/test_oauth2/test_device_code_grant.py .........              [ 48%]
tests/flask/test_oauth2/test_implicit_grant.py ......                    [ 51%]
tests/flask/test_oauth2/test_introspection_endpoint.py ....              [ 53%]
tests/flask/test_oauth2/test_jwt_access_token.py ..s.................... [ 64%]
.......                                                                  [ 67%]
tests/flask/test_oauth2/test_jwt_bearer_client_auth.py .......           [ 70%]
tests/flask/test_oauth2/test_jwt_bearer_grant.py ......                  [ 73%]
tests/flask/test_oauth2/test_oauth2_server.py .......                    [ 76%]
tests/flask/test_oauth2/test_openid_code_grant.py ........               [ 80%]
tests/flask/test_oauth2/test_openid_hybrid_grant.py ..........           [ 85%]
tests/flask/test_oauth2/test_openid_implict_grant.py ........            [ 89%]
tests/flask/test_oauth2/test_password_grant.py ........                  [ 92%]
tests/flask/test_oauth2/test_refresh_token.py ..........                 [ 97%]
tests/flask/test_oauth2/test_revocation_endpoint.py .....                [100%]

======================= 211 passed, 1 skipped in 21.51s ========================
dh_auto_test: error: pybuild --test -i python{version} -p "3.13 3.12" 
--test-pytest --test-args tests/flask returned exit code 13
make[1]: *** [debian/rules:13: override_dh_auto_test] Error 25
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
make: *** [debian/rules:7: binary] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
--------------------------------------------------------------------------------
Build finished at 2024-09-18T22:22:41Z

If required, the full build log is available here (for the next 30 days):
https://debusine.debian.net/artifact/781049/

This bug has been filed at "normal" severity, as we haven't started the
transition to add 3.13 as a supported version, yet. This will be raised to RC
as soon as that happens, hopefully well before trixie.

Thanks,

Stefano

Reply via email to