python-distlib fails to build with Python 3.13.0a1. https://docs.python.org/3.13/whatsnew/3.13.html The test fails: ________________________ ScriptTestCase.test_script_run ________________________ self = <test_scripts.ScriptTestCase testMethod=test_script_run> def test_script_run(self): files = self.maker.make('test = cgi:print_directory') self.assertEqual(len(files), 2) p = subprocess.Popen([sys.executable, files[0]], stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p.communicate() > self.assertIn(b'<H3>Current Working Directory:</H3>', stdout) E AssertionError: b'<H3>Current Working Directory:</H3>' not found in b'' tests/test_scripts.py:334: AssertionError =========================== short test summary info ============================ FAILED tests/test_scripts.py::ScriptTestCase::test_script_run - AssertionErro... ===== 1 failed, 200 passed, 34 skipped, 3 deselected, 3 warnings in 10.58s ===== For the build logs, see: https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/06550785-python-distlib/ For all our attempts to build python-distlib with Python 3.13, see: https://copr.fedorainfracloud.org/coprs/g/python/python3.13/package/python-distlib/ 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.
For the record, the original test failures are: ________________________ ScriptTestCase.test_script_run ________________________ self = <test_scripts.ScriptTestCase testMethod=test_script_run> def test_script_run(self): files = self.maker.make('test = cgi:print_directory') self.assertEqual(len(files), 2) p = subprocess.Popen([sys.executable, files[0]], stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p.communicate() > self.assertIn(b'<H3>Current Working Directory:</H3>', stdout) E AssertionError: b'<H3>Current Working Directory:</H3>' not found in b'' tests/test_scripts.py:334: AssertionError __________________________________ test_suite __________________________________ def test_suite(): #README = os.path.join(os.path.dirname(__file__), 'README.txt') #suite = [doctest.DocFileSuite(README), unittest.makeSuite(VersionTestCase)] > suite = [unittest.makeSuite(VersionTestCase), unittest.makeSuite(CompatibilityTestCase), unittest.makeSuite(LegacyVersionTestCase), unittest.makeSuite(SemanticVersionTestCase)] tests/test_version.py:648: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ name = 'makeSuite' def __getattr__(name): if name == 'IsolatedAsyncioTestCase': global IsolatedAsyncioTestCase from .async_case import IsolatedAsyncioTestCase return IsolatedAsyncioTestCase > raise AttributeError(f"module {__name__!r} has no attribute {name!r}") E AttributeError: module 'unittest' has no attribute 'makeSuite' /usr/lib64/python3.13/unittest/__init__.py:80: AttributeError However, test_suite is not a test. Upstream does not use pytest, they use unittest and they have a function called test_suite which is used to "prepare" the test suite. It uses functions removed from unittest in Python 3.13. pytest collects this function as a test (due to the name of the function), executes it and it normally succeeds (there are no asserts). However now it fails. While this probably needs to be addressed upstream, a simple workaround was to deselect the non-test. ------------- The actual failure here is test_script_run. I belive that the called subprocess fails (the call does not check that) and the error is in stderr (the test does not display that). Possibly related to the missing cgi module.
I believe the test is using the cgi module only as a convenient way to test running a script created by ScriptMaker.make(). As such, skipping it for now in copr.
Reported upstream https://github.com/pypa/distlib/issues/208
And fixed upstream https://github.com/pypa/distlib/commit/e27569b02d9718c19ece71ce6d5124b967277399
A downstream backport: https://src.fedoraproject.org/rpms/python-distlib/pull-request/17