Bug 2328700 - mopidy fails to build with Python 3.14: AssertionError: expected call not found
Summary: mopidy fails to build with Python 3.14: AssertionError: expected call not found
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mopidy
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Tobias
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.14
TreeView+ depends on / blocked
 
Reported: 2024-11-25 16:26 UTC by Karolina Surma
Modified: 2024-12-06 22:43 UTC (History)
3 users (show)

Fixed In Version: mopidy-4.0.0~a2-1.fc42
Clone Of:
Environment:
Last Closed: 2024-12-06 22:43:25 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

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.


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