Bug 2247011 - python-lxml fails to build with Python 3.13: AttributeError: module 'unittest' has no attribute 'makeSuite'
Summary: python-lxml fails to build with Python 3.13: AttributeError: module 'unittest...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-lxml
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2023-10-30 11:56 UTC by Karolina Surma
Modified: 2023-11-15 13:22 UTC (History)
10 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2023-11-15 13:22:05 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Fedora Package Sources python-lxml pull-request 32 0 None None None 2023-11-06 10:46:12 UTC
Github lxml lxml pull 385 0 None Draft Avoid usage of unittest.makeSuite, removed from Python 3.13 2023-10-30 12:03:58 UTC
Launchpad.net lxml/+bug/2041841 0 None None None 2023-10-30 12:03:58 UTC

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


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