Bug 2210706 - python-qstylizer fails to build with Python 3.12: AttributeError: 'called_once_with' is not avalid assertion. Use a spec for the mock if 'called_once_with' is meant to bean attribute.
Summary: python-qstylizer fails to build with Python 3.12: AttributeError: 'called_onc...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: python-qstylizer
Version: 39
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Orphan Owner
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.12
TreeView+ depends on / blocked
 
Reported: 2023-05-29 08:23 UTC by Tomáš Hrnčiar
Modified: 2023-08-16 12:55 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2023-05-29 08:23:27 UTC
python-qstylizer fails to build with Python 3.12.0b1.


=================================== FAILURES ===================================
_________________________ test_create_child_rule_list __________________________

mocker = <pytest_mock.plugin.MockerFixture object at 0x7fbd04e0fec0>
style_class = <class 'qstylizer.style.StyleRule'>, css = <StyleSheet />

    def test_create_child_rule_list(mocker, style_class, css):
        import qstylizer.style
        style_list = "StyleListInstance"
        name = "test"
        mocker.patch.object(
            qstylizer.style, "StyleRuleList", return_value=style_list
        )
        mocked_set_child_rule = mocker.patch.object(style_class, "set_child_rule")
        assert css.create_child_rule_list(name) == style_list
>       mocked_set_child_rule.called_once_with(name, style_list)

test/unit/test_style.py:187: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MagicMock name='set_child_rule' id='140449807488384'>
name = 'called_once_with'

    def __getattr__(self, name):
        if name in {'_mock_methods', '_mock_unsafe'}:
            raise AttributeError(name)
        elif self._mock_methods is not None:
            if name not in self._mock_methods or name in _all_magics:
                raise AttributeError("Mock object has no attribute %r" % name)
        elif _is_magic(name):
            raise AttributeError(name)
        if not self._mock_unsafe and (not self._mock_methods or name not in self._mock_methods):
            if name.startswith(('assert', 'assret', 'asert', 'aseert', 'assrt')) or name in _ATTRIB_DENY_LIST:
>               raise AttributeError(
                    f"{name!r} is not a valid assertion. Use a spec "
                    f"for the mock if {name!r} is meant to be an attribute.")
E               AttributeError: 'called_once_with' is not a valid assertion. Use a spec for the mock if 'called_once_with' is meant to be an attribute.. Did you mean: 'assert_called_once_with'?

gh-100690: Mock objects which are not unsafe
will now raise an AttributeError when accessing an attribute that matches the
name of an assertion but without the prefix assert_, e.g. accessing called_once
instead of assert_called_once. This is in addition to this already happening
for accessing attributes with prefixes assert, assret, asert, aseert, and
assrt.

https://github.com/python/cpython/issues/100690
https://docs.python.org/3.12/whatsnew/3.12.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.12/fedora-rawhide-x86_64/05969176-python-qstylizer/

For all our attempts to build python-qstylizer with Python 3.12, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/package/python-qstylizer/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.12:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/

Let us know here if you have any questions.

Python 3.12 is planned to be included in Fedora 39. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.12.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
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 1 Fedora Release Engineering 2023-08-16 07:14:32 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.

Comment 2 Fedora Admin user for bugzilla script actions 2023-08-16 12:55:44 UTC
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.


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