Bug 2245859 - pyserial fails to build with Python 3.13: AttributeError: module 'unittest' has no attribute 'findTestCases'
Summary: pyserial fails to build with Python 3.13: AttributeError: module 'unittest' h...
Keywords:
Status: CLOSED COMPLETED
Alias: None
Product: Fedora
Classification: Fedora
Component: pyserial
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Paul P Komkoff Jr
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2023-10-24 11:37 UTC by Karolina Surma
Modified: 2024-09-04 16:09 UTC (History)
3 users (show)

Fixed In Version: pyserial-3.5-9.fc41
Clone Of:
Environment:
Last Closed: 2024-09-04 16:09:49 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github pyserial pyserial issues 754 0 None open Test failures with Python 3.13.0b1: `AttributeError: module 'unittest' has no attribute 'findTestCases'` 2024-05-30 06:56:33 UTC

Description Karolina Surma 2023-10-24 11:37:23 UTC
pyserial fails to build with Python 3.13.0a1.

+ /usr/bin/python3 test/run_all_tests.py
Patching sys.path to test local version. Testing Version: 3.5
Traceback (most recent call last):
  File "/builddir/build/BUILD/pyserial-3.5/test/run_all_tests.py", line 40, in <module>
    testsuite = unittest.findTestCases(module)
                ^^^^^^^^^^^^^^^^^^^^^^
  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 'findTestCases'

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/06546828-pyserial/

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

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-10-31 14:25:39 UTC
I managed to build the package by adding this bit to the specfile:

+sed -i 's/unittest.findTestCases(module)/unittest.TestLoader().loadTestsFromModule(modulename)/' test/run_all_tests.py

Comment 2 Aoife Moloney 2024-02-15 23:01:22 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 40 development cycle.
Changing version to 40.

Comment 3 Karolina Surma 2024-05-30 06:56:34 UTC
Upstream issue: https://github.com/pyserial/pyserial/issues/754
Downstream patch with a sed expression: https://src.fedoraproject.org/rpms/pyserial/pull-request/6


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