Bug 2247011

Summary: python-lxml fails to build with Python 3.13: AttributeError: module 'unittest' has no attribute 'makeSuite'
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-lxmlAssignee: Miro Hrončok <mhroncok>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: cstratak, igor.raits, ksurma, lbalhar, me, mhroncok, mizdebsk, python-maint, python-packagers-sig, torsava
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-15 13:22:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2244836    

Description Karolina Surma 2023-10-30 11:56:48 UTC
python-lxml fails to build with Python 3.13.0a1.

+ /usr/bin/python3 test.py -vuf
Traceback (most recent call last):
  File "/builddir/build/BUILD/lxml-4.9.3/test.py", line 616, in <module>
    exitcode = main(sys.argv)
               ^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/lxml-4.9.3/test.py", line 553, in main
    test_cases = get_test_cases(test_files, cfg, cov=cov)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/lxml-4.9.3/test.py", line 262, in get_test_cases
    test_suite = module.test_suite()
                 ^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/lxml-4.9.3/src/lxml/html/tests/test_clean.py", line 299, in test_suite
    suite.addTests(unittest.makeSuite(CleanerTest))
                   ^^^^^^^^^^^^^^^^^^
  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/06578802-python-lxml/

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

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 Miro Hrončok 2023-10-30 12:03:58 UTC
https://github.com/lxml/lxml/pull/385 fixes this and uncoveres a problem in one of the doctests, reported upstream as https://bugs.launchpad.net/lxml/+bug/2041841

Comment 2 Miro Hrončok 2023-10-30 12:16:58 UTC
I built the package in Copr with:


sed -i 's/unittest.makeSuite/unittest.defaultTestLoader.loadTestsFromTestCase/g' $(grep -rl makeSuite)
rm src/lxml/tests/test_xpathevaluator.py