Bug 2251779 - python-zope-testrunner fails to build with Python 3.13: ImportError: cannot import name '_start_new_thread' from 'threading'
Summary: python-zope-testrunner fails to build with Python 3.13: ImportError: cannot i...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-zope-testrunner
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Jerry James
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2023-11-27 14:57 UTC by Karolina Surma
Modified: 2024-06-19 00:17 UTC (History)
8 users (show)

Fixed In Version: python-zope-testrunner-6.4-3.fc41
Clone Of:
Environment:
Last Closed: 2024-06-19 00:17:39 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Fedora Package Sources python-zope-testrunner pull-request 2 0 None None None 2024-06-03 13:04:57 UTC
Github zopefoundation zope.testrunner issues 167 0 None open Tests are broken on Python 3.13a6+ 2024-05-02 20:14:43 UTC

Description Karolina Surma 2023-11-27 14:57:46 UTC
python-zope-testrunner fails to build with Python 3.13.0a1.

This report is automated and not very verbose, but we'll try to get back here with details.

+ python3 -m unittest discover -s zope/testrunner -t .
.........................................E
======================================================================
ERROR: zope.testrunner.tests.test_threadsupport (unittest.loader._FailedTest.zope.testrunner.tests.test_threadsupport)
----------------------------------------------------------------------
ImportError: Failed to import test module: zope.testrunner.tests.test_threadsupport
Traceback (most recent call last):
  File "/usr/lib64/python3.13/unittest/loader.py", line 394, in _find_test_path
    module = self._get_module_from_name(name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/unittest/loader.py", line 337, in _get_module_from_name
    __import__(name)
  File "/builddir/build/BUILDROOT/python-zope-testrunner-6.2-1.fc40.x86_64/usr/lib/python3.13/site-packages/zope/testrunner/tests/test_threadsupport.py", line 16, in <module>
    from threading import _start_new_thread
ImportError: cannot import name '_start_new_thread' from 'threading' (/usr/lib64/python3.13/threading.py). Did you mean: '_start_joinable_thread'?


----------------------------------------------------------------------
Ran 42 tests in 0.014s


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

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/06692273-python-zope-testrunner/

For all our attempts to build python-zope-testrunner with Python 3.13, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/package/python-zope-testrunner/

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

Let us know here if you have any questions.

Python 3.13 is planned to be included in Fedora 41.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.13.
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 Aoife Moloney 2024-02-15 23:05:48 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 40 development cycle.
Changing version to 40.

Comment 2 Michel Lind 2024-02-27 02:37:30 UTC
Looks like only doctests are failing now

Comment 3 Jerry James 2024-03-15 02:30:56 UTC
Yes, there are extra lines of output with python 3.13.  This patch fixes the build with 3.13:

--- zope.testrunner-6.4/src/zope/testrunner/tests/testrunner-subunit.rst.orig	2024-02-27 02:42:53.000000000 -0700
+++ zope.testrunner-6.4/src/zope/testrunner/tests/testrunner-subunit.rst	2024-03-14 20:09:07.806043416 -0600
@@ -495,6 +495,7 @@ Let's run tests including a module with
     Traceback (most recent call last):
       File "/home/benji/workspace/all-the-trunks/zope.testrunner/src/zope/testrunner/testrunner-ex/sample2/sample23/sampletests_i.py", line 17, in <module>
         class Test(unittest.TestCase):
+          ...
       File "/home/benji/workspace/all-the-trunks/zope.testrunner/src/zope/testrunner/testrunner-ex/sample2/sample23/sampletests_i.py", line 22, in Test
         raise TypeError('eek')
     TypeError: eek
--- zope.testrunner-6.4/src/zope/testrunner/tests/testrunner-subunit-v2.rst.orig	2024-02-27 02:42:53.000000000 -0700
+++ zope.testrunner-6.4/src/zope/testrunner/tests/testrunner-subunit-v2.rst	2024-03-14 20:09:20.740858494 -0600
@@ -458,6 +458,7 @@ Let's run tests including a module with
     Traceback (most recent call last):
       File "/home/benji/workspace/all-the-trunks/zope.testrunner/src/zope/testrunner/testrunner-ex/sample2/sample23/sampletests_i.py", line 17, in <module>
         class Test(unittest.TestCase):
+          ...
       File "/home/benji/workspace/all-the-trunks/zope.testrunner/src/zope/testrunner/testrunner-ex/sample2/sample23/sampletests_i.py", line 22, in Test
         raise TypeError('eek')
     TypeError: eek

Sadly, it breaks the build with python 3.12.  Apparently ellipsis does not match zero lines.  I'm not very familiar with python's doctest module.  If somebody knows how to match zero or more lines at that spot, please educate me.

Comment 4 Miro Hrončok 2024-06-03 12:58:53 UTC
I tried applying https://github.com/zopefoundation/zope.testrunner/pull/172 but it still fails as if the ellipsis was not working:

+ /usr/bin/python3 -m tox --current-env -q --recreate -e py313
Running tests at level 1
Running zope.testrunner.layer.UnitTests tests:
  Set up zope.testrunner.layer.UnitTests in 0.000 seconds.
  Running:
............................./usr/lib/python3.13/site-packages/pkg_resources/__init__.py:2833: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('zope')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(pkg)
............/builddir/build/BUILD/python-zope-testrunner-6.4-build/BUILDROOT/usr/lib/python3.13/site-packages/zope/testrunner/tests/testrunner-ex/gc-after-test.py:59: ResourceWarning: not closed - this is no error: testing ResourceWarning here
  warn(ResourceWarning(
/builddir/build/BUILD/python-zope-testrunner-6.4-build/BUILDROOT/usr/lib/python3.13/site-packages/zope/testrunner/tests/testrunner-ex/gc-after-test.py:59: ResourceWarning: not closed - this is no error: testing ResourceWarning here
  warn(ResourceWarning(
.../builddir/build/BUILD/python-zope-testrunner-6.4-build/BUILDROOT/usr/lib/python3.13/site-packages/zope/testrunner/tests/testrunner-ex/gc-after-test.py:59: ResourceWarning: not closed - this is no error: testing ResourceWarning here
  warn(ResourceWarning(
.

Failure in test /builddir/build/BUILD/python-zope-testrunner-6.4-build/BUILDROOT/usr/lib/python3.13/site-packages/zope/testrunner/tests/testrunner-subunit.rst
Failed doctest test for testrunner-subunit.rst
  File "/builddir/build/BUILD/python-zope-testrunner-6.4-build/BUILDROOT/usr/lib/python3.13/site-packages/zope/testrunner/tests/testrunner-subunit.rst", line 0

----------------------------------------------------------------------
File "/builddir/build/BUILD/python-zope-testrunner-6.4-build/BUILDROOT/usr/lib/python3.13/site-packages/zope/testrunner/tests/testrunner-subunit.rst", line 475, in testrunner-subunit.rst
Failed example:
    testrunner.run_internal(defaults)
Differences (ndiff with -expected +actual):
      test: sample2.badsyntax
      tags: zope:import_error
    - error: sample2.badsyntax [...
    ?                           ---
    + error: sample2.badsyntax [
       testrunner-ex/sample2/badsyntax.py", line 16
          importx unittest  # noqa: E999
    -                 ...^
    +             ^^^^^^^^
    - SyntaxError: invalid syntax...
    ?                            ---
    + SyntaxError: invalid syntax
      ]
      test: sample2.sample21.sampletests_i
      tags: zope:import_error
      error: sample2.sample21.sampletests_i [
      Traceback (most recent call last):
       testrunner-ex/sample2/sample21/sampletests_i.py", Line NNN, in ?
    -     import zope.testrunner.huh  # noqa: F401...
    ?                                             ---
    +     import zope.testrunner.huh  # noqa: F401
    +     ^^^^^^^^^^^^^^^^^^^^^^^^^^
      ModuleNotFoundError: No module named 'zope.testrunner.huh'
      ]
      test: sample2.sample23.sampletests_i
      tags: zope:import_error
      error: sample2.sample23.sampletests_i [
      Traceback (most recent call last):
       testrunner-ex/sample2/sample23/sampletests_i.py", Line NNN, in ?
          class Test(unittest.TestCase):
    +     ...<4 lines>...
    +         raise TypeError('eek')
       testrunner-ex/sample2/sample23/sampletests_i.py", Line NNN, in Test
          raise TypeError('eek')
      TypeError: eek
      ]
      time: YYYY-MM-DD HH:MM:SS.mmmmmmZ
      test: samplelayers.Layer1:setUp
      tags: zope:layer
    - ...
    + time: YYYY-MM-DD HH:MM:SS.mmmmmmZ
    + successful: samplelayers.Layer1:setUp
    ... snip ...
    + time: YYYY-MM-DD HH:MM:SS.mmmmmmZ
    + successful: samplelayers.Layer1:tearDown
      True

.

Failure in test /builddir/build/BUILD/python-zope-testrunner-6.4-build/BUILDROOT/usr/lib/python3.13/site-packages/zope/testrunner/tests/testrunner-subunit-v2.rst
Failed doctest test for testrunner-subunit-v2.rst
  File "/builddir/build/BUILD/python-zope-testrunner-6.4-build/BUILDROOT/usr/lib/python3.13/site-packages/zope/testrunner/tests/testrunner-subunit-v2.rst", line 0

----------------------------------------------------------------------
File "/builddir/build/BUILD/python-zope-testrunner-6.4-build/BUILDROOT/usr/lib/python3.13/site-packages/zope/testrunner/tests/testrunner-subunit-v2.rst", line 436, in testrunner-subunit-v2.rst
Failed example:
    subunit_summarize(testrunner.run_internal, defaults)
Differences (ndiff with -expected +actual):
    - id=sample2.badsyntax status=inprogress
    + id=sample2.badsyntax status=inprogress 
    ?                                       +
    - id=sample2.badsyntax
    + id=sample2.badsyntax 
    ?                     +
    - traceback (text/x-traceback...)...
    + traceback (text/x-traceback; charset="utf8"; language="python")
       testrunner-ex/sample2/badsyntax.py", line 16
          importx unittest  # noqa: E999
    -                 ...^
    +             ^^^^^^^^
    - SyntaxError: invalid syntax...
    ?                            ---
    + SyntaxError: invalid syntax
      <BLANKLINE>
    - id=sample2.badsyntax status=fail tags=(zope:import_error)
    + id=sample2.badsyntax status=fail tags=(zope:import_error) 
    ?                                                          +
    - id=sample2.sample21.sampletests_i status=inprogress
    + id=sample2.sample21.sampletests_i status=inprogress 
    ?                                                    +
    - id=sample2.sample21.sampletests_i
    + id=sample2.sample21.sampletests_i 
    ?                                  +
    - traceback (text/x-traceback...)
    + traceback (text/x-traceback; charset="utf8"; language="python")
      Traceback (most recent call last):
       testrunner-ex/sample2/sample21/sampletests_i.py", Line NNN, in ?
    -     import zope.testrunner.huh  # noqa: F401...
    ?                                             ---
    +     import zope.testrunner.huh  # noqa: F401
    +     ^^^^^^^^^^^^^^^^^^^^^^^^^^
      ModuleNotFoundError: No module named 'zope.testrunner.huh'
      <BLANKLINE>
    - id=sample2.sample21.sampletests_i status=fail tags=(zope:import_error)
    + id=sample2.sample21.sampletests_i status=fail tags=(zope:import_error) 
    ?                                                                       +
    - id=sample2.sample23.sampletests_i status=inprogress
    + id=sample2.sample23.sampletests_i status=inprogress 
    ?                                                    +
    - id=sample2.sample23.sampletests_i
    + id=sample2.sample23.sampletests_i 
    ?                                  +
    - traceback (text/x-traceback...)
    + traceback (text/x-traceback; charset="utf8"; language="python")
      Traceback (most recent call last):
       testrunner-ex/sample2/sample23/sampletests_i.py", Line NNN, in ?
          class Test(unittest.TestCase):
    +     ...<4 lines>...
    +         raise TypeError('eek')
       testrunner-ex/sample2/sample23/sampletests_i.py", Line NNN, in Test
          raise TypeError('eek')
      TypeError: eek
      <BLANKLINE>
    - id=sample2.sample23.sampletests_i status=fail tags=(zope:import_error)
    + id=sample2.sample23.sampletests_i status=fail tags=(zope:import_error) 
    ?                                                                       +
    - id=samplelayers.Layer1:setUp status=inprogress...
    ?                                               ^^^
    + id=samplelayers.Layer1:setUp status=inprogress !runnable 
    ?                                               ^^^^^^^^^^^
    - ...
    + id=samplelayers.Layer1:setUp status=success tags=(zope:layer) !runnable 
    + id=sampletestsf.TestA1.test_x1 status=inprogress 
    ... snip ...
    + id=samplelayers.Layer1:tearDown status=success tags=(zope:layer) !runnable 
      True

.................................................
  Ran 95 tests with 2 failures, 0 errors, 0 skipped in 13.140 seconds.
Tearing down left over layers:
  Tear down zope.testrunner.layer.UnitTests in 0.000 seconds.

Tests with failures:
   /builddir/build/BUILD/python-zope-testrunner-6.4-build/BUILDROOT/usr/lib/python3.13/site-packages/zope/testrunner/tests/testrunner-subunit.rst
   /builddir/build/BUILD/python-zope-testrunner-6.4-build/BUILDROOT/usr/lib/python3.13/site-packages/zope/testrunner/tests/testrunner-subunit-v2.rst
py313: exit 1 (13.29 seconds) /builddir/build/BUILD/python-zope-testrunner-6.4-build/zope.testrunner-6.4> zope-testrunner --test-path=src -vc pid=1956
  py313: FAIL code 1 (13.29 seconds)
  evaluation failed :( (13.33 seconds)

Comment 5 Miro Hrončok 2024-06-03 13:04:02 UTC
Ah, https://github.com/zopefoundation/zope.testrunner/pull/173 was needed as well.


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