zopefoundation / ZConfig

A configuration library supporting a hierarchical schema-driven configuration model, and allowing a schema to specify data conversion routines written in Python.
Other
8 stars 12 forks source link

Test failure in test_filehandler_reopen_thread_safety on Python 3.13 #96

Closed musicinmybrain closed 2 weeks ago

musicinmybrain commented 3 weeks ago

BUG/PROBLEM REPORT / FEATURE REQUEST

What I did:

  1. Check out current master, abf6f26fd27b79a23978058b274e397cca72b504
  2. Run tox -e py313

What I expect to happen:

All tests pass, as they do for tox -e py312.

What actually happened:

Failure in test test_filehandler_reopen_thread_safety (ZConfig.components.logger.tests.test_logger.TestReopeningLogfiles.test_filehandler_reopen_thread_safety)
Traceback (most recent call last):
  File "/usr/lib64/python3.13/unittest/case.py", line 58, in testPartExecutor
    yield
  File "/usr/lib64/python3.13/unittest/case.py", line 651, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.13/unittest/case.py", line 606, in _callTestMethod
    if method() is not None:
  File "/home/ben/src/forks/ZConfig/src/ZConfig/components/logger/tests/test_logger.py", line 714, in test_filehandler_reopen_thread_safety
    self.assertEqual(calls, ["acquire", "acquire", "release", "release"])
  File "/usr/lib64/python3.13/unittest/case.py", line 907, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/usr/lib64/python3.13/unittest/case.py", line 1113, in assertListEqual
    self.assertSequenceEqual(list1, list2, msg, seq_type=list)
  File "/usr/lib64/python3.13/unittest/case.py", line 1095, in assertSequenceEqual
    self.fail(msg)
  File "/usr/lib64/python3.13/unittest/case.py", line 732, in fail
    raise self.failureException(msg)
AssertionError: Lists differ: [] != ['acquire', 'acquire', 'release', 'release']

Second list contains 4 additional elements.
First extra element 0:
'acquire'

- []
+ ['acquire', 'acquire', 'release', 'release']

------
2024-05-11T11:12:45 INFO root An info message
------
2024-05-11T11:12:45 INFO root We see an info message
------
2024-05-11T11:12:45 INFO root Here is another info message
/home/ben/src/forks/ZConfig/src/ZConfig/tests/test_schema2html.py:106: DeprecationWarning: The frontend.OptionParser class will be replaced by a subclass of argparse.ArgumentParser in Docutils 0.21 or later.
  settings=docutils.frontend.OptionParser(
/usr/lib64/python3.13/optparse.py:1000: DeprecationWarning: The frontend.Option class will be removed in Docutils 0.21 or later.
  option = self.option_class(*args, **kwargs)
/home/ben/src/forks/ZConfig/src/ZConfig/tests/test_schema2html.py:106: DeprecationWarning: The frontend.OptionParser class will be replaced by a subclass of argparse.ArgumentParser in Docutils 0.21 or later.
  settings=docutils.frontend.OptionParser(
/usr/lib64/python3.13/optparse.py:1000: DeprecationWarning: The frontend.Option class will be removed in Docutils 0.21 or later.
  option = self.option_class(*args, **kwargs)
/home/ben/src/forks/ZConfig/src/ZConfig/tests/test_schema2html.py:106: DeprecationWarning: The frontend.OptionParser class will be replaced by a subclass of argparse.ArgumentParser in Docutils 0.21 or later.
  settings=docutils.frontend.OptionParser(
/usr/lib64/python3.13/optparse.py:1000: DeprecationWarning: The frontend.Option class will be removed in Docutils 0.21 or later.
  option = self.option_class(*args, **kwargs)
/home/ben/src/forks/ZConfig/src/ZConfig/tests/test_schema2html.py:106: DeprecationWarning: The frontend.OptionParser class will be replaced by a subclass of argparse.ArgumentParser in Docutils 0.21 or later.
  settings=docutils.frontend.OptionParser(
/usr/lib64/python3.13/optparse.py:1000: DeprecationWarning: The frontend.Option class will be removed in Docutils 0.21 or later.
  option = self.option_class(*args, **kwargs)
/home/ben/src/forks/ZConfig/src/ZConfig/tests/test_schema2html.py:106: DeprecationWarning: The frontend.OptionParser class will be replaced by a subclass of argparse.ArgumentParser in Docutils 0.21 or later.
  settings=docutils.frontend.OptionParser(
/usr/lib64/python3.13/optparse.py:1000: DeprecationWarning: The frontend.Option class will be removed in Docutils 0.21 or later.
  option = self.option_class(*args, **kwargs)

What version of Python and Zope/Addons I am using:

Fedora Linux 39, Python 3.13.0a6, Zope versions as installed to the virtualenv by default: zope.exceptions 5.0.1, zope.interface 6.3, zope.testrunner 6.4


It wasn’t immediately obvious to me what the best way to fix this should be. I believe it may be related to https://github.com/python/cpython/issues/109461 / https://github.com/python/cpython/pull/109462 / https://github.com/python/cpython/pull/109462.

icemac commented 2 weeks ago

Thank you for your report. I created a PR in #97 to reproduce it in CI. But running on 3.13b1 requires a fix in zope.interface first.

musicinmybrain commented 2 weeks ago

Thank you for your report. I created a PR in #97 to reproduce it in CI. But running on 3.13b1 requires a fix in zope.interface first.

Thanks! I can confirm that – when I skip this test downstream – I also run into the bug that https://github.com/zopefoundation/zope.interface/pull/294 is trying to fix. Looks like that should be dealt with soon.

icemac commented 2 weeks ago

After zope.interface is fixed now, GitHub Actions also show this problem. I have no idea what to do to fix it.