Package: src:logbook
Version: 1.5.3-5.2
Severity: important
Tags: sid trixie
User: [email protected]
Usertags: python3.12

logbook's autopkg tests fail with Python 3.12:

[...]
332s =================================== FAILURES =================================== 332s __________________________ test_warning_redirections ___________________________
332s
332s     def test_warning_redirections():
332s         from logbook.compat import redirected_warnings
332s         with logbook.TestHandler() as handler:
332s             redirector = redirected_warnings()
332s             redirector.start()
332s             try:
332s                 from warnings import warn, resetwarnings
332s                 resetwarnings()
332s warn(RuntimeWarning('Testing' + str(next(test_warning_redirections_i))))
332s             finally:
332s                 redirector.end()
332s
332s >       assert len(handler.records) == 1
332s E       assert 2 == 1
332s E + where 2 = len([<logbook.base.LogRecord object at 0x7f8f80d180b0>, <logbook.base.LogRecord object at 0x7f8f8157ec30>]) 332s E + where [<logbook.base.LogRecord object at 0x7f8f80d180b0>, <logbook.base.LogRecord object at 0x7f8f8157ec30>] = <logbook.handlers.TestHandler object at 0x7f8f80972ae0>.records
332s
332s tests/test_logging_compat.py:86: AssertionError
332s _________________________ test_mail_handler_arguments __________________________
332s
332s     def test_mail_handler_arguments():
332s         with patch('smtplib.SMTP', autospec=True) as mock_smtp:
332s
332s # Test the mail handler with supported arguments before changes to
332s             # secure, credentials, and starttls
332s             mail_handler = logbook.MailHandler(
332s                 from_addr='[email protected]',
332s                 recipients='[email protected]',
332s                 server_addr=('server.example.com', 465),
332s                 credentials=('username', 'password'),
332s                 secure=('keyfile', 'certfile'))
332s
332s >           mail_handler.get_connection()
332s
332s tests/test_mail_handler.py:126:
332s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 332s /usr/lib/python3/dist-packages/logbook/handlers.py:1380: in get_connection
332s     con.starttls(keyfile=keyfile, certfile=certfile)
332s /usr/lib/python3.12/unittest/mock.py:1132: in __call__
332s     self._mock_check_sig(*args, **kwargs)
332s /usr/lib/python3.12/unittest/mock.py:131: in checksig
332s     sig.bind(*args, **kwargs)
332s /usr/lib/python3.12/inspect.py:3259: in bind
332s     return self._bind(args, kwargs)
332s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
332s
332s self = <Signature (*, context=None)>, args = ()
332s kwargs = {'certfile': 'certfile', 'keyfile': 'keyfile'}
332s
332s     def _bind(self, args, kwargs, *, partial=False):
332s         """Private method. Don't use directly."""
332s
332s         arguments = {}
332s
332s         parameters = iter(self.parameters.values())
332s         parameters_ex = ()
332s         arg_vals = iter(args)
332s
332s         while True:
332s # Let's iterate through the positional arguments and corresponding
332s             # parameters
332s             try:
332s                 arg_val = next(arg_vals)
332s             except StopIteration:
332s                 # No more positional arguments
332s                 try:
332s                     param = next(parameters)
332s                 except StopIteration:
332s # No more parameters. That's it. Just need to check that
332s                     # we have no `kwargs` after this while loop
332s                     break
332s                 else:
332s                     if param.kind == _VAR_POSITIONAL:
332s # That's OK, just empty *args. Let's start parsing
332s                         # kwargs
332s                         break
332s                     elif param.name in kwargs:
332s                         if param.kind == _POSITIONAL_ONLY:
332s msg = '{arg!r} parameter is positional only, ' \
332s                                   'but was passed as a keyword'
332s                             msg = msg.format(arg=param.name)
332s                             raise TypeError(msg) from None
332s                         parameters_ex = (param,)
332s                         break
332s                     elif (param.kind == _VAR_KEYWORD or
332s param.default is not _empty): 332s # That's fine too - we have a default value for this 332s # parameter. So, lets start parsing `kwargs`, starting
332s                         # with the current parameter
332s                         parameters_ex = (param,)
332s                         break
332s                     else:
332s # No default, not VAR_KEYWORD, not VAR_POSITIONAL,
332s                         # not in `kwargs`
332s                         if partial:
332s                             parameters_ex = (param,)
332s                             break
332s                         else:
332s                             if param.kind == _KEYWORD_ONLY:
332s                                 argtype = ' keyword-only'
332s                             else:
332s                                 argtype = ''
332s msg = 'missing a required{argtype} argument: {arg!r}' 332s msg = msg.format(arg=param.name, argtype=argtype)
332s                             raise TypeError(msg) from None
332s             else:
332s                 # We have a positional argument to process
332s                 try:
332s                     param = next(parameters)
332s                 except StopIteration:
332s raise TypeError('too many positional arguments') from None
332s                 else:
332s                     if param.kind in (_VAR_KEYWORD, _KEYWORD_ONLY):
332s # Looks like we have no parameter for this positional
332s                         # argument
332s                         raise TypeError(
332s                             'too many positional arguments') from None
332s
332s                     if param.kind == _VAR_POSITIONAL:
332s # We have an '*args'-like argument, let's fill it with 332s # all positional arguments we have left and move on to
332s                         # the next phase
332s                         values = [arg_val]
332s                         values.extend(arg_vals)
332s                         arguments[param.name] = tuple(values)
332s                         break
332s
332s if param.name in kwargs and param.kind != _POSITIONAL_ONLY:
332s                         raise TypeError(
332s 'multiple values for argument {arg!r}'.format(
332s                                 arg=param.name)) from None
332s
332s                     arguments[param.name] = arg_val
332s
332s         # Now, we iterate through the remaining parameters to process
332s         # keyword arguments
332s         kwargs_param = None
332s         for param in itertools.chain(parameters_ex, parameters):
332s             if param.kind == _VAR_KEYWORD:
332s                 # Memorize that we have a '**kwargs'-like parameter
332s                 kwargs_param = param
332s                 continue
332s
332s             if param.kind == _VAR_POSITIONAL:
332s # Named arguments don't refer to '*args'-like parameters.
332s                 # We only arrive here if the positional arguments ended
332s                 # before reaching the last parameter before *args.
332s                 continue
332s
332s             param_name = param.name
332s             try:
332s                 arg_val = kwargs.pop(param_name)
332s             except KeyError:
332s # We have no value for this parameter. It's fine though,
332s                 # if it has a default value, or it is an '*args'-like
332s                 # parameter, left alone by the processing of positional
332s                 # arguments.
332s                 if (not partial and param.kind != _VAR_POSITIONAL and
332s param.default is _empty): 332s raise TypeError('missing a required argument: {arg!r}'. \
332s                                     format(arg=param_name)) from None
332s
332s             else:
332s                 if param.kind == _POSITIONAL_ONLY:
332s # This should never happen in case of a properly built
332s                     # Signature object (but let's have this check here
332s                     # to ensure correct behaviour just in case)
332s raise TypeError('{arg!r} parameter is positional only, '
332s                                     'but was passed as a keyword'. \
332s                                     format(arg=param.name))
332s
332s                 arguments[param_name] = arg_val
332s
332s         if kwargs:
332s             if kwargs_param is not None:
332s                 # Process our '**kwargs'-like parameter
332s                 arguments[kwargs_param.name] = kwargs
332s             else:
332s >               raise TypeError(
332s 'got an unexpected keyword argument {arg!r}'.format(
332s                         arg=next(iter(kwargs))))
332s E               TypeError: got an unexpected keyword argument 'keyfile'
332s
332s /usr/lib/python3.12/inspect.py:3248: TypeError
332s =============================== warnings summary ===============================
332s tests/test_asyncio.py::test_asyncio_context_management
332s /tmp/autopkgtest.2S63iW/autopkgtest_tmp/build/tests/test_asyncio.py:21: DeprecationWarning: There is no current event loop 332s asyncio.get_event_loop().run_until_complete(asyncio.gather(task(h1, 'task1'), task(h2, 'task2')))
332s
332s tests/test_asyncio.py: 200 warnings
332s tests/test_deadlock.py: 2 warnings
332s tests/test_file_handler.py: 80 warnings
332s tests/test_fingers_crossed_handler.py: 26 warnings
332s tests/test_flags.py: 4 warnings
332s tests/test_groups.py: 7 warnings
332s tests/test_handler_errors.py: 2 warnings
332s tests/test_handlers.py: 31 warnings
332s tests/test_log_record.py: 10 warnings
332s tests/test_logbook.py: 16 warnings
332s tests/test_logging_api.py: 14 warnings
332s tests/test_logging_compat.py: 11 warnings
332s tests/test_logging_times.py: 2 warnings
332s tests/test_mail_handler.py: 20 warnings
332s tests/test_more.py: 19 warnings
332s tests/test_null_handler.py: 8 warnings
332s tests/test_processors.py: 4 warnings
332s tests/test_queues.py: 2 warnings
332s tests/test_syslog_handler.py: 12 warnings
332s tests/test_test_handler.py: 32 warnings
332s tests/test_unicode.py: 7 warnings
332s tests/test_utils.py: 15 warnings
332s /usr/lib/python3/dist-packages/logbook/base.py:466: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
332s     self.time = _datetime_factory()
332s
332s tests/test_file_handler.py: 16 warnings
332s /usr/lib/python3/dist-packages/logbook/handlers.py:902: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
332s     self._timestamp = self._get_timestamp(_datetime_factory())
332s
332s tests/test_fingers_crossed_handler.py: 26 warnings
332s tests/test_logging_api.py: 4 warnings
332s tests/test_mail_handler.py: 16 warnings
332s /usr/lib/python3/dist-packages/logbook/concurrency.py:141: DeprecationWarning: currentThread() is deprecated, use current_thread() instead
332s     return currentThread().getName()
332s
332s tests/test_fingers_crossed_handler.py: 26 warnings
332s tests/test_logging_api.py: 4 warnings
332s tests/test_mail_handler.py: 16 warnings
332s /usr/lib/python3/dist-packages/logbook/concurrency.py:141: DeprecationWarning: getName() is deprecated, get the name attribute instead
332s     return currentThread().getName()
332s
332s tests/test_helpers.py::test_datehelpers
332s /usr/lib/python3/dist-packages/logbook/helpers.py:220: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
332s     d = datetime.utcnow()
332s
332s tests/test_logging_compat.py: 10 warnings
332s /usr/lib/python3/dist-packages/logbook/compat.py:128: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
332s     return datetime.utcfromtimestamp(timestamp)
332s
332s tests/test_logging_times.py::test_timedate_format[ContextEnteringStrategy]
332s tests/test_logging_times.py::test_timedate_format[PushingStrategy]
332s /tmp/autopkgtest.2S63iW/autopkgtest_tmp/build/tests/test_logging_times.py:30: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
332s     t2 = datetime.utcnow()
332s
332s tests/test_queues.py::test_missing_zeromq
332s /usr/lib/python3/dist-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning: Exception ignored in: <function ZeroMQHandler.__del__ at 0x7f8f80909e40>
332s
332s   Traceback (most recent call last):
332s File "/usr/lib/python3/dist-packages/logbook/queues.py", line 241, in __del__
332s       self.close(linger=100)
332s File "/usr/lib/python3/dist-packages/logbook/queues.py", line 232, in close
332s       self.socket.close(linger)
332s       ^^^^^^^^^^^
332s   AttributeError: 'ZeroMQHandler' object has no attribute 'socket'
332s
332s     warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
332s
332s tests/test_queues.py::test_threaded_wrapper_handler
332s tests/test_queues.py::test_threaded_wrapper_handler_emit
332s tests/test_queues.py::test_threaded_wrapper_handler_emit_batched
332s /usr/lib/python3/dist-packages/logbook/queues.py:621: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
332s     self._thread.setDaemon(True)
332s
332s tests/test_queues.py::test_subscriber_group
332s tests/test_queues.py::test_subscriber_group
332s /usr/lib/python3/dist-packages/logbook/queues.py:261: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
332s     self._thread.setDaemon(True)
332s
332s tests/test_queues.py: 20 warnings
332s /usr/lib/python3.12/multiprocessing/popen_fork.py:66: DeprecationWarning: This process (pid=2431) is multi-threaded, use of fork() may lead to deadlocks in the child.
332s     self.pid = os.fork()
332s
332s -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
332s =========================== short test summary info ============================ 332s FAILED tests/test_logging_compat.py::test_warning_redirections - assert 2 == 1 332s FAILED tests/test_mail_handler.py::test_mail_handler_arguments - TypeError: g... 332s =========== 2 failed, 194 passed, 17 skipped, 672 warnings in 1.85s ============ 332s E: pybuild pybuild:395: test: plugin distutils failed with: exit code=1: cd /tmp/autopkgtest.2S63iW/autopkgtest_tmp/build; python3.12 -m pytest tests

Reply via email to