Bug 2245863 - python-genshi fails to build with Python 3.13: AttributeError: module 'unittest' has no attribute 'makeSuite'
Summary: python-genshi fails to build with Python 3.13: AttributeError: module 'unitte...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-genshi
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Felix Schwarz
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 2247238 (view as bug list)
Depends On:
Blocks: PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2023-10-24 11:44 UTC by Karolina Surma
Modified: 2023-11-10 09:26 UTC (History)
4 users (show)

Fixed In Version: 0.7.7-8
Clone Of:
Environment:
Last Closed: 2023-11-10 09:26:09 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2023-10-24 11:44:11 UTC
python-genshi fails to build with Python 3.13.0a1.

+ /usr/bin/python3 setup.py test
running test
<snip>
/builddir/build/BUILD/Genshi-0.7.7/genshi/filters/html.py:357: SyntaxWarning: invalid escape sequence '\('
  u'[Uu][Rr\u0280][Ll\u029F]%s*\(([^)]+)' % (r'\s')).finditer
Traceback (most recent call last):
  File "/builddir/build/BUILD/Genshi-0.7.7/setup.py", line 98, in <module>
    setup(
  File "/usr/lib/python3.13/site-packages/setuptools/__init__.py", line 103, in setup
    return distutils.core.setup(**attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/setuptools/_distutils/core.py", line 185, in setup
    return run_commands(dist)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/usr/lib/python3.13/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.13/site-packages/setuptools/dist.py", line 989, in run_command
    super().run_command(command)
  File "/usr/lib/python3.13/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/usr/lib/python3.13/site-packages/setuptools/command/test.py", line 223, in run
    self.run_tests()
  File "/usr/lib/python3.13/site-packages/setuptools/command/test.py", line 226, in run_tests
    test = unittest.main(
           ^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/unittest/main.py", line 103, in __init__
    self.parseArgs(argv)
  File "/usr/lib64/python3.13/unittest/main.py", line 142, in parseArgs
    self.createTests()
  File "/usr/lib64/python3.13/unittest/main.py", line 153, in createTests
    self.test = self.testLoader.loadTestsFromNames(self.testNames,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/unittest/loader.py", line 207, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/unittest/loader.py", line 192, in loadTestsFromName
    test = obj()
           ^^^^^
  File "/builddir/build/BUILD/Genshi-0.7.7/genshi/tests/__init__.py", line 23, in suite
    suite.addTest(builder.suite())
                  ^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/Genshi-0.7.7/genshi/tests/builder.py", line 70, in suite
    suite.addTest(unittest.makeSuite(ElementFactoryTestCase, 'test'))
                  ^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/unittest/__init__.py", line 80, in __getattr__
    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
AttributeError: module 'unittest' has no attribute 'makeSuite'

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

Removed the following unittest functions, deprecated in Python 3.11:
- unittest.findTestCases()
- unittest.makeSuite()
- unittest.getTestCaseNames()


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/06546784-python-genshi/

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

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 Karolina Surma 2023-11-01 08:27:45 UTC
*** Bug 2247238 has been marked as a duplicate of this bug. ***

Comment 2 Karolina Surma 2023-11-01 08:28:57 UTC
I made the package build with the sed expression:

+sed -i "s/unittest.makeSuite(\(.*\), 'test')/unittest.defaultTestLoader.loadTestsFromTestCase(\1)/g" $(grep -rl makeSuite)

Comment 3 Felix Schwarz 2023-11-10 08:28:15 UTC
Thank you for your detailed report. I rebuilt the package in rawhide. Please close the issue once it works in Python 3.13.

Comment 4 Miro Hrončok 2023-11-10 09:26:09 UTC
Thanks.


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