Skip to content

Tests fail on Python 3.14.7 #271

Description

@K900
=================================== FAILURES ===================================
______________ LoginQuotingTest.test_login_quotes_plain_username _______________

self = <tests.test_mailbox.LoginQuotingTest testMethod=test_login_quotes_plain_username>

    def test_login_quotes_plain_username(self):
        """Plain username is also correctly passed through quoting."""
        with patch.object(MailBox, '_get_mailbox_client', return_value=self._make_mock_client()):
            mb = MailBox('localhost')
>           mb.login('user', 'pass', initial_folder=None)

tests/test_mailbox.py:167:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
imap_tools/mailbox.py:103: in login
    self.client._simple_command('LOGIN', self.client._quote(username), self.client._quote(password)))  # noqa
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/nix/store/3n4qphl9s728sz8frmpqqrv9b1m87g68-python3-3.14.7/lib/python3.14/unittest/mock.py:1176: in __call__
    return self._mock_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/nix/store/3n4qphl9s728sz8frmpqqrv9b1m87g68-python3-3.14.7/lib/python3.14/unittest/mock.py:1180: in _mock_call
    return self._execute_mock_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/nix/store/3n4qphl9s728sz8frmpqqrv9b1m87g68-python3-3.14.7/lib/python3.14/unittest/mock.py:1247: in _execute_mock_call
    result = effect(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^
tests/test_mailbox.py:149: in <lambda>
    mock_client._quote.side_effect = lambda arg: imaplib.IMAP4._quote(mock_client, arg)
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/nix/store/3n4qphl9s728sz8frmpqqrv9b1m87g68-python3-3.14.7/lib/python3.14/imaplib.py:1461: in _quote
    arg = bytes(arg, self._encoding)
                     ^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <MagicMock spec='IMAP4' id='140737311708496'>, name = '_encoding'

    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)
E               AttributeError: Mock object has no attribute '_encoding'

/nix/store/3n4qphl9s728sz8frmpqqrv9b1m87g68-python3-3.14.7/lib/python3.14/unittest/mock.py:697: AttributeError
________ LoginQuotingTest.test_login_quotes_username_with_special_chars ________

self = <tests.test_mailbox.LoginQuotingTest testMethod=test_login_quotes_username_with_special_chars>

    def test_login_quotes_username_with_special_chars(self):
        """Username containing special IMAP chars (e.g. *) must be quoted."""
        with patch.object(MailBox, '_get_mailbox_client', return_value=self._make_mock_client()):
            mb = MailBox('localhost')
>           mb.login('user*name', 'pass', initial_folder=None)

tests/test_mailbox.py:158:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
imap_tools/mailbox.py:103: in login
    self.client._simple_command('LOGIN', self.client._quote(username), self.client._quote(password)))  # noqa
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/nix/store/3n4qphl9s728sz8frmpqqrv9b1m87g68-python3-3.14.7/lib/python3.14/unittest/mock.py:1176: in __call__
    return self._mock_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/nix/store/3n4qphl9s728sz8frmpqqrv9b1m87g68-python3-3.14.7/lib/python3.14/unittest/mock.py:1180: in _mock_call
    return self._execute_mock_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/nix/store/3n4qphl9s728sz8frmpqqrv9b1m87g68-python3-3.14.7/lib/python3.14/unittest/mock.py:1247: in _execute_mock_call
    result = effect(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^
tests/test_mailbox.py:149: in <lambda>
    mock_client._quote.side_effect = lambda arg: imaplib.IMAP4._quote(mock_client, arg)
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/nix/store/3n4qphl9s728sz8frmpqqrv9b1m87g68-python3-3.14.7/lib/python3.14/imaplib.py:1461: in _quote
    arg = bytes(arg, self._encoding)
                     ^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <MagicMock spec='IMAP4' id='140737309439184'>, name = '_encoding'

    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)
E               AttributeError: Mock object has no attribute '_encoding'

/nix/store/3n4qphl9s728sz8frmpqqrv9b1m87g68-python3-3.14.7/lib/python3.14/unittest/mock.py:697: AttributeError

Have not looked too closely, but likely caused by python/cpython@03d0909.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions