Bug 2273609 - python-chalice fails to build with pytest 8: TypeError: exceptions must be derived from Warning, not <class 'NoneType'>
Summary: python-chalice fails to build with pytest 8: TypeError: exceptions must be de...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-chalice
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Davide Cavalca
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 2256331
TreeView+ depends on / blocked
 
Reported: 2024-04-05 10:08 UTC by Tomáš Hrnčiar
Modified: 2024-05-01 04:14 UTC (History)
3 users (show)

Fixed In Version: python-chalice-1.31.0-1.fc40
Clone Of:
Environment:
Last Closed: 2024-05-01 04:14:09 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2024-04-05 10:08:40 UTC
python-chalice fails to build with pytest 8.

=================================== FAILURES ===================================
_________________________ test_python_version_is_valid _________________________

    def test_python_version_is_valid():
        config = Config.create()
>       with pytest.warns(None) as record:

tests/unit/deploy/test_validate.py:51: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = WarningsChecker(record=True), expected_warning = None, match_expr = None

    def __init__(
        self,
        expected_warning: Union[Type[Warning], Tuple[Type[Warning], ...]] = Warning,
        match_expr: Optional[Union[str, Pattern[str]]] = None,
        *,
        _ispytest: bool = False,
    ) -> None:
        check_ispytest(_ispytest)
        super().__init__(_ispytest=True)
    
        msg = "exceptions must be derived from Warning, not %s"
        if isinstance(expected_warning, tuple):
            for exc in expected_warning:
                if not issubclass(exc, Warning):
                    raise TypeError(msg % type(exc))
            expected_warning_tup = expected_warning
        elif isinstance(expected_warning, type) and issubclass(
            expected_warning, Warning
        ):
            expected_warning_tup = (expected_warning,)
        else:
>           raise TypeError(msg % type(expected_warning))
E           TypeError: exceptions must be derived from Warning, not <class 'NoneType'>

/usr/lib/python3.12/site-packages/_pytest/recwarn.py:285: TypeError
____ TestLocalBuiltinAuthorizers.test_does_authorize_unsupported_authorizer ____

self = <tests.unit.test_local.TestLocalBuiltinAuthorizers object at 0x7f52819f6de0>
demo_app_auth = <chalice.app.Chalice object at 0x7f527f3eae70>
lambda_context_args = ['lambda_name', 256]
create_event = <function create_event.<locals>.create_event_inner at 0x7f52820834c0>

    def test_does_authorize_unsupported_authorizer(self, demo_app_auth,
                                                   lambda_context_args,
                                                   create_event):
        authorizer = LocalGatewayAuthorizer(demo_app_auth)
        path = '/iam'
        event = create_event(path, 'GET', {})
        context = LambdaContext(*lambda_context_args)
>       with pytest.warns(None) as recorded_warnings:

tests/unit/test_local.py:963: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = WarningsChecker(record=True), expected_warning = None, match_expr = None

    def __init__(
        self,
        expected_warning: Union[Type[Warning], Tuple[Type[Warning], ...]] = Warning,
        match_expr: Optional[Union[str, Pattern[str]]] = None,
        *,
        _ispytest: bool = False,
    ) -> None:
        check_ispytest(_ispytest)
        super().__init__(_ispytest=True)
    
        msg = "exceptions must be derived from Warning, not %s"
        if isinstance(expected_warning, tuple):
            for exc in expected_warning:
                if not issubclass(exc, Warning):
                    raise TypeError(msg % type(exc))
            expected_warning_tup = expected_warning
        elif isinstance(expected_warning, type) and issubclass(
            expected_warning, Warning
        ):
            expected_warning_tup = (expected_warning,)
        else:
>           raise TypeError(msg % type(expected_warning))
E           TypeError: exceptions must be derived from Warning, not <class 'NoneType'>

/usr/lib/python3.12/site-packages/_pytest/recwarn.py:285: TypeError
__ TestLocalBuiltinAuthorizers.test_does_authorize_unsupported_cognito_token ___

self = <tests.unit.test_local.TestLocalBuiltinAuthorizers object at 0x7f52819f5ac0>
lambda_context_args = ['lambda_name', 256]
demo_app_auth = <chalice.app.Chalice object at 0x7f527f14d130>
create_event = <function create_event.<locals>.create_event_inner at 0x7f528085b6a0>

    def test_does_authorize_unsupported_cognito_token(self,
                                                      lambda_context_args,
                                                      demo_app_auth,
                                                      create_event):
        authorizer = LocalGatewayAuthorizer(demo_app_auth)
        path = '/cognito'
        event = create_event(path, 'GET', {})
        event["headers"]["authorization"] = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhYWFhYWFhYS1iYmJiLWNjY2MtZGRkZC1lZWVlZWVlZWVlZWUiLCJhdWQiOiJ4eHh4eHh4eHh4eHhleGFtcGxlIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInRva2VuX3VzZSI6ImlkIiwiYXV0aF90aW1lIjoxNTAwMDA5NDAwLCJpc3MiOiJodHRwczovL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tL3VzLWVhc3QtMV9leGFtcGxlIiwiZXhwIjoxNTg0NzIzNjE2LCJnaXZlbl9uYW1lIjoiSmFuZSIsImlhdCI6MTUwMDAwOTQwMCwiZW1haWwiOiJqYW5lZG9lQGV4YW1wbGUuY29tIiwianRpIjoiZDdlMTEzM2EtMWUzYS00MjMxLWFlN2ItMjhkODVlZTBiMTRkIn0.SN5n-A3kxboNYg0sGIOipVUksCdn6xRJmAK9kSZof10"  # noqa
        context = LambdaContext(*lambda_context_args)
>       with pytest.warns(None) as recorded_warnings:

tests/unit/test_local.py:1046: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = WarningsChecker(record=True), expected_warning = None, match_expr = None

    def __init__(
        self,
        expected_warning: Union[Type[Warning], Tuple[Type[Warning], ...]] = Warning,
        match_expr: Optional[Union[str, Pattern[str]]] = None,
        *,
        _ispytest: bool = False,
    ) -> None:
        check_ispytest(_ispytest)
        super().__init__(_ispytest=True)
    
        msg = "exceptions must be derived from Warning, not %s"
        if isinstance(expected_warning, tuple):
            for exc in expected_warning:
                if not issubclass(exc, Warning):
                    raise TypeError(msg % type(exc))
            expected_warning_tup = expected_warning
        elif isinstance(expected_warning, type) and issubclass(
            expected_warning, Warning
        ):
            expected_warning_tup = (expected_warning,)
        else:
>           raise TypeError(msg % type(expected_warning))
E           TypeError: exceptions must be derived from Warning, not <class 'NoneType'>

/usr/lib/python3.12/site-packages/_pytest/recwarn.py:285: TypeError
______________________ TestUI.test_write_goes_to_out_obj _______________________

self = <tests.unit.test_utils.TestUI object at 0x7f528259a8d0>

    def test_write_goes_to_out_obj(self):
>       self.ui.write("Foo")
E       AttributeError: 'TestUI' object has no attribute 'ui'

tests/unit/test_utils.py:25: AttributeError
______________________ TestUI.test_error_goes_to_err_obj _______________________

self = <tests.unit.test_utils.TestUI object at 0x7f528259b740>

    def test_error_goes_to_err_obj(self):
>       self.ui.error("Foo")
E       AttributeError: 'TestUI' object has no attribute 'ui'

tests/unit/test_utils.py:30: AttributeError
___________________ TestUI.test_confirm_raises_own_exception ___________________

self = <tests.unit.test_utils.TestUI object at 0x7f52825ccb30>

    def test_confirm_raises_own_exception(self):
        confirm = mock.Mock(spec=click.confirm)
        confirm.side_effect = click.Abort()
>       ui = utils.UI(self.out, self.err, confirm)
E       AttributeError: 'TestUI' object has no attribute 'out'

tests/unit/test_utils.py:37: AttributeError
______________________ TestUI.test_confirm_returns_value _______________________

self = <tests.unit.test_utils.TestUI object at 0x7f52825cf350>

    def test_confirm_returns_value(self):
        confirm = mock.Mock(spec=click.confirm)
        confirm.return_value = 'foo'
>       ui = utils.UI(self.out, self.err, confirm)
E       AttributeError: 'TestUI' object has no attribute 'out'

tests/unit/test_utils.py:44: AttributeError
___________________ TestTimestampUtils.test_iso_no_timezone ____________________

self = <tests.unit.test_utils.TestTimestampUtils object at 0x7f52825cc6e0>

    def test_iso_no_timezone(self):
        assert self.timestamp_convert.timestamp_to_datetime(
>           '2020-01-01T00:00:01.000000') == datetime(2020, 1, 1, 0, 0, 1)
E       AttributeError: 'TestTimestampUtils' object has no attribute 'timestamp_convert'

tests/unit/test_utils.py:150: AttributeError
__________________ TestTimestampUtils.test_iso_with_timezone ___________________

self = <tests.unit.test_utils.TestTimestampUtils object at 0x7f52825cf050>

    def test_iso_with_timezone(self):
        assert (
            self.timestamp_convert.timestamp_to_datetime(
                '2020-01-01T00:00:01.000000-01:00'
            ) == datetime(2020, 1, 1, 0, 0, 1, tzinfo=tz.tzoffset(None, -3600))
>       )
E       AttributeError: 'TestTimestampUtils' object has no attribute 'timestamp_convert'

tests/unit/test_utils.py:157: AttributeError
_____________ TestTimestampUtils.test_to_datetime_relative_second ______________

self = <tests.unit.test_utils.TestTimestampUtils object at 0x7f52825cf710>

    def test_to_datetime_relative_second(self):
>       self.set_now(sec=2)

tests/unit/test_utils.py:160: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.unit.test_utils.TestTimestampUtils object at 0x7f52825cf710>
year = 2020, month = 1, day = 1, hour = 0, minute = 0, sec = 2

    def set_now(self, year=2020, month=1, day=1, hour=0, minute=0, sec=0):
        self.now = datetime(
            year, month, day, hour, minute, sec, tzinfo=tz.tzutc())
>       self.mock_now.return_value = self.now
E       AttributeError: 'TestTimestampUtils' object has no attribute 'mock_now'

tests/unit/test_utils.py:146: AttributeError
________ TestTimestampUtils.test_to_datetime_relative_multiple_seconds _________

self = <tests.unit.test_utils.TestTimestampUtils object at 0x7f52825cc7a0>

    def test_to_datetime_relative_multiple_seconds(self):
>       self.set_now(sec=5)

tests/unit/test_utils.py:167: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.unit.test_utils.TestTimestampUtils object at 0x7f52825cc7a0>
year = 2020, month = 1, day = 1, hour = 0, minute = 0, sec = 5

    def set_now(self, year=2020, month=1, day=1, hour=0, minute=0, sec=0):
        self.now = datetime(
            year, month, day, hour, minute, sec, tzinfo=tz.tzutc())
>       self.mock_now.return_value = self.now
E       AttributeError: 'TestTimestampUtils' object has no attribute 'mock_now'

tests/unit/test_utils.py:146: AttributeError
_____________ TestTimestampUtils.test_to_datetime_relative_minute ______________

self = <tests.unit.test_utils.TestTimestampUtils object at 0x7f52825ceff0>

    def test_to_datetime_relative_minute(self):
>       self.set_now(minute=2)

tests/unit/test_utils.py:174: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.unit.test_utils.TestTimestampUtils object at 0x7f52825ceff0>
year = 2020, month = 1, day = 1, hour = 0, minute = 2, sec = 0

    def set_now(self, year=2020, month=1, day=1, hour=0, minute=0, sec=0):
        self.now = datetime(
            year, month, day, hour, minute, sec, tzinfo=tz.tzutc())
>       self.mock_now.return_value = self.now
E       AttributeError: 'TestTimestampUtils' object has no attribute 'mock_now'

tests/unit/test_utils.py:146: AttributeError
______________ TestTimestampUtils.test_to_datetime_relative_hour _______________

self = <tests.unit.test_utils.TestTimestampUtils object at 0x7f52825cdbb0>

    def test_to_datetime_relative_hour(self):
>       self.set_now(hour=2)

tests/unit/test_utils.py:181: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.unit.test_utils.TestTimestampUtils object at 0x7f52825cdbb0>
year = 2020, month = 1, day = 1, hour = 2, minute = 0, sec = 0

    def set_now(self, year=2020, month=1, day=1, hour=0, minute=0, sec=0):
        self.now = datetime(
            year, month, day, hour, minute, sec, tzinfo=tz.tzutc())
>       self.mock_now.return_value = self.now
E       AttributeError: 'TestTimestampUtils' object has no attribute 'mock_now'

tests/unit/test_utils.py:146: AttributeError
_______________ TestTimestampUtils.test_to_datetime_relative_day _______________

self = <tests.unit.test_utils.TestTimestampUtils object at 0x7f52825cc350>

    def test_to_datetime_relative_day(self):
>       self.set_now(day=3)  # 1970-01-03

tests/unit/test_utils.py:188: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.unit.test_utils.TestTimestampUtils object at 0x7f52825cc350>
year = 2020, month = 1, day = 3, hour = 0, minute = 0, sec = 0

    def set_now(self, year=2020, month=1, day=1, hour=0, minute=0, sec=0):
        self.now = datetime(
            year, month, day, hour, minute, sec, tzinfo=tz.tzutc())
>       self.mock_now.return_value = self.now
E       AttributeError: 'TestTimestampUtils' object has no attribute 'mock_now'

tests/unit/test_utils.py:146: AttributeError
______________ TestTimestampUtils.test_to_datetime_relative_week _______________

self = <tests.unit.test_utils.TestTimestampUtils object at 0x7f52825cd8b0>

    def test_to_datetime_relative_week(self):
>       self.set_now(day=14)

tests/unit/test_utils.py:195: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.unit.test_utils.TestTimestampUtils object at 0x7f52825cd8b0>
year = 2020, month = 1, day = 14, hour = 0, minute = 0, sec = 0

    def set_now(self, year=2020, month=1, day=1, hour=0, minute=0, sec=0):
        self.now = datetime(
            year, month, day, hour, minute, sec, tzinfo=tz.tzutc())
>       self.mock_now.return_value = self.now
E       AttributeError: 'TestTimestampUtils' object has no attribute 'mock_now'

tests/unit/test_utils.py:146: AttributeError

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/unit/deploy/test_validate.py::test_python_version_is_valid - Typ...
FAILED tests/unit/test_local.py::TestLocalBuiltinAuthorizers::test_does_authorize_unsupported_authorizer
FAILED tests/unit/test_local.py::TestLocalBuiltinAuthorizers::test_does_authorize_unsupported_cognito_token
FAILED tests/unit/test_utils.py::TestUI::test_write_goes_to_out_obj - Attribu...
FAILED tests/unit/test_utils.py::TestUI::test_error_goes_to_err_obj - Attribu...
FAILED tests/unit/test_utils.py::TestUI::test_confirm_raises_own_exception - ...
FAILED tests/unit/test_utils.py::TestUI::test_confirm_returns_value - Attribu...
FAILED tests/unit/test_utils.py::TestTimestampUtils::test_iso_no_timezone - A...
FAILED tests/unit/test_utils.py::TestTimestampUtils::test_iso_with_timezone
FAILED tests/unit/test_utils.py::TestTimestampUtils::test_to_datetime_relative_second
FAILED tests/unit/test_utils.py::TestTimestampUtils::test_to_datetime_relative_multiple_seconds
FAILED tests/unit/test_utils.py::TestTimestampUtils::test_to_datetime_relative_minute
FAILED tests/unit/test_utils.py::TestTimestampUtils::test_to_datetime_relative_hour
FAILED tests/unit/test_utils.py::TestTimestampUtils::test_to_datetime_relative_day
FAILED tests/unit/test_utils.py::TestTimestampUtils::test_to_datetime_relative_week
=== 15 failed, 1144 passed, 15 skipped, 1 deselected, 199 warnings in 35.63s ===

https://docs.pytest.org/en/stable/changelog.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/thrnciar/pytest/fedora-rawhide-x86_64/07247849-python-chalice/

For all our attempts to build python-chalice with pytest 8, see:
https://copr.fedorainfracloud.org/coprs/thrnciar/pytest/package/python-chalice/

Let us know here if you have any questions.

Pytest 8 is planned to be included in Fedora 41. And this bugzilla is a
heads up before we merge new pytest into rawhide. For more info see a Fedora Change
proposal https://fedoraproject.org/wiki/Changes/Pytest_8

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 2 Fedora Update System 2024-04-22 16:25:20 UTC
FEDORA-2024-f7949ad03d (python-chalice-1.31.0-1.fc40) has been submitted as an update to Fedora 40.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-f7949ad03d

Comment 3 Fedora Update System 2024-04-23 03:44:36 UTC
FEDORA-2024-f7949ad03d has been pushed to the Fedora 40 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-f7949ad03d`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-f7949ad03d

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 4 Fedora Update System 2024-05-01 04:14:09 UTC
FEDORA-2024-f7949ad03d (python-chalice-1.31.0-1.fc40) has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.