Bug 2245281
| Summary: | python-distlib fails to build with Python 3.13: ScriptTestCase.test_script_run fails (unexpected empty stdout of subprocess, possibly related to missing cgi module) | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Karolina Surma <ksurma> |
| Component: | python-distlib | Assignee: | Miro Hrončok <mhroncok> |
| Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | rawhide | CC: | cstratak, ksurma, logans, mhroncok, 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-29 13:12:49 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-20 13:52:01 UTC
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 A downstream backport: https://src.fedoraproject.org/rpms/python-distlib/pull-request/17 |