Bug 2328700

Summary: mopidy fails to build with Python 3.14: AssertionError: expected call not found
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: mopidyAssignee: Tobi <t-fedora>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: ksurma, mhroncok, t-fedora
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: mopidy-4.0.0~a2-1.fc42 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-12-06 22:43:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2322407    

Description Karolina Surma 2024-11-25 16:26:07 UTC
mopidy fails to build with Python 3.14.0a2.

_________________ CommandParsingTest.test_missing_positionals __________________

self = <tests.test_commands.CommandParsingTest testMethod=test_missing_positionals>

    def test_missing_positionals(self):
        cmd = commands.Command()
        cmd.add_argument("bar")
    
        with self.assertRaises(SystemExit):
            cmd.parse([], prog="foo")
    
>       self.exit_mock.assert_called_once_with(
            1,
            "the following arguments are required: bar, _args",
            "usage: foo bar",
        )

tests/test_commands.py:175: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.14/unittest/mock.py:992: in assert_called_once_with
    return self.assert_called_with(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MagicMock name='exit' id='140258774322880'>
args = (1, 'the following arguments are required: bar, _args', 'usage: foo bar')
kwargs = {}
expected = call(1, 'the following arguments are required: bar, _args', 'usage: foo bar')
actual = call(1, 'the following arguments are required: bar', 'usage: foo bar')
_error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7f9089de9c70>
cause = None

    def assert_called_with(self, /, *args, **kwargs):
        """assert that the last call was made with the specified arguments.
    
        Raises an AssertionError if the args and keyword args passed in are
        different to the last call to the mock."""
        if self.call_args is None:
            expected = self._format_mock_call_signature(args, kwargs)
            actual = 'not called.'
            error_message = ('expected call not found.\nExpected: %s\n  Actual: %s'
                    % (expected, actual))
            raise AssertionError(error_message)
    
        def _error_message():
            msg = self._format_mock_failure_message(args, kwargs)
            return msg
        expected = self._call_matcher(_Call((args, kwargs), two=True))
        actual = self._call_matcher(self.call_args)
        if actual != expected:
            cause = expected if isinstance(expected, Exception) else None
>           raise AssertionError(_error_message()) from cause
E           AssertionError: expected call not found.
E           Expected: exit(1, 'the following arguments are required: bar, _args', 'usage: foo bar')
E             Actual: exit(1, 'the following arguments are required: bar', 'usage: foo bar')

/usr/lib64/python3.14/unittest/mock.py:980: AssertionError
____________ CommandParsingTest.test_missing_positionals_subcommand ____________

self = <tests.test_commands.CommandParsingTest testMethod=test_missing_positionals_subcommand>

    def test_missing_positionals_subcommand(self):
        child = commands.Command()
        child.add_argument("baz")
    
        cmd = commands.Command()
        cmd.add_child("bar", child)
    
        with self.assertRaises(SystemExit):
            cmd.parse(["bar"], prog="foo")
    
>       self.exit_mock.assert_called_once_with(
            1,
            "the following arguments are required: baz, _args",
            "usage: foo bar baz",
        )

tests/test_commands.py:191: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.14/unittest/mock.py:992: in assert_called_once_with
    return self.assert_called_with(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <MagicMock name='exit' id='140258774322208'>
args = (1, 'the following arguments are required: baz, _args', 'usage: foo bar baz')
kwargs = {}
expected = call(1, 'the following arguments are required: baz, _args', 'usage: foo bar baz')
actual = call(1, 'the following arguments are required: baz', 'usage: foo bar baz')
_error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7f9089de8d50>
cause = None

    def assert_called_with(self, /, *args, **kwargs):
        """assert that the last call was made with the specified arguments.
    
        Raises an AssertionError if the args and keyword args passed in are
        different to the last call to the mock."""
        if self.call_args is None:
            expected = self._format_mock_call_signature(args, kwargs)
            actual = 'not called.'
            error_message = ('expected call not found.\nExpected: %s\n  Actual: %s'
                    % (expected, actual))
            raise AssertionError(error_message)
    
        def _error_message():
            msg = self._format_mock_failure_message(args, kwargs)
            return msg
        expected = self._call_matcher(_Call((args, kwargs), two=True))
        actual = self._call_matcher(self.call_args)
        if actual != expected:
            cause = expected if isinstance(expected, Exception) else None
>           raise AssertionError(_error_message()) from cause
E           AssertionError: expected call not found.
E           Expected: exit(1, 'the following arguments are required: baz, _args', 'usage: foo bar baz')
E             Actual: exit(1, 'the following arguments are required: baz', 'usage: foo bar baz')

/usr/lib64/python3.14/unittest/mock.py:980: AssertionError
=========================== short test summary info ============================
FAILED tests/test_commands.py::CommandParsingTest::test_missing_positionals
FAILED tests/test_commands.py::CommandParsingTest::test_missing_positionals_subcommand
================== 2 failed, 1449 passed, 2 warnings in 5.03s ==================

https://docs.python.org/3.14/whatsnew/3.14.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.14/fedora-rawhide-x86_64/08301897-mopidy/

For all our attempts to build mopidy with Python 3.14, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/package/mopidy/

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.14:
https://copr.fedorainfracloud.org/coprs/g/python/python3.14/

Let us know here if you have any questions.

Python 3.14 is planned to be included in Fedora 43.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14.
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 Update System 2024-12-06 22:38:55 UTC
FEDORA-2024-601e33a39e (mopidy-4.0.0~a2-1.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-601e33a39e

Comment 2 Fedora Update System 2024-12-06 22:43:25 UTC
FEDORA-2024-601e33a39e (mopidy-4.0.0~a2-1.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.