Bug 2019410

Summary: python-pycurl fails to build with Python 3.11: AttributeError: 'SetoptTest' object has no attribute 'assertEquals'
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-pycurlAssignee: Lukáš Zaoral <lzaoral>
Status: CLOSED DEFERRED QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 36CC: kdudka, mhroncok, msekleta, svashisht, thrnciar
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-pycurl-7.44.1-4.fc36 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-02-10 14:17:51 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: 2021856    
Bug Blocks: 1992484, 2016048, 2045102    

Description Tomáš Hrnčiar 2021-11-02 13:59:10 UTC
python-pycurl fails to build with Python 3.11.0a1.

=================================== FAILURES ===================================
_____________________ SetoptTest.test_set_httpheader_none ______________________

self = <tests.setopt_test.SetoptTest testMethod=test_set_httpheader_none>

    def test_set_httpheader_none(self):
        self.curl.setopt(self.curl.HTTPHEADER, ('x-test: foo',))
        self.curl.setopt(self.curl.URL, 'http://%s:8380/header?h=x-test' % localhost)
        io = util.BytesIO()
        self.curl.setopt(self.curl.WRITEDATA, io)
        self.curl.perform()
>       self.assertEquals(util.b('foo'), io.getvalue())
E       AttributeError: 'SetoptTest' object has no attribute 'assertEquals'

tests/setopt_test.py:75: AttributeError
_______________________ SetoptTest.test_unset_httpheader _______________________

self = <tests.setopt_test.SetoptTest testMethod=test_unset_httpheader>

    def test_unset_httpheader(self):
        self.curl.setopt(self.curl.HTTPHEADER, ('x-test: foo',))
        self.curl.setopt(self.curl.URL, 'http://%s:8380/header?h=x-test' % localhost)
        io = util.BytesIO()
        self.curl.setopt(self.curl.WRITEDATA, io)
        self.curl.perform()
>       self.assertEquals(util.b('foo'), io.getvalue())
E       AttributeError: 'SetoptTest' object has no attribute 'assertEquals'

tests/setopt_test.py:61: AttributeError

Removed many old deprecated unittest features:
    TestCase method aliases failUnlessEqual, failIfEqual, failUnless, failIf,
    failUnlessRaises, failUnlessAlmostEqual, failIfAlmostEqual (deprecated in
    Python 3.1), assertEquals, assertNotEquals, assert_, assertAlmostEquals,
    assertNotAlmostEquals, assertRegexpMatches, assertRaisesRegexp (deprecated in
    Python 3.2), and assertNotRegexpMatches (deprecated in Python 3.5).

https://bugs.python.org/issue45162
https://docs.python.org/3.11/whatsnew/3.11.html


For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/02910448-python-pycurl/

For all our attempts to build python-pycurl with Python 3.11, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/python-pycurl/

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.11:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/

Let us know here if you have any questions.

Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11.
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 Lukáš Zaoral 2021-11-03 14:44:21 UTC
Should be fixed in python-pycurl-7.44.1-4.fc36.

Comment 2 Lukáš Zaoral 2021-11-03 15:10:27 UTC
Oh, I see that the build in mentioned Copr is still failing with the following output:

Error: 
 Problem: package python3-flaky-3.7.0-4.fc35.noarch requires python(abi) = 3.10, but none of the providers can be installed
  - package python3-devel-3.11.0~a1-1.fc36.x86_64 conflicts with python3 < 3.11.0~a1-1.fc36 provided by python3-3.10.0-2.fc36.x86_64
  - package python3-devel-3.11.0~a1-1.fc36.x86_64 conflicts with python3 < 3.11.0~a1-1.fc36 provided by python3-3.10.0-2.fc36.i686

python3-flaky is a new build dependency of this package and I see that python3-flaky is not present in the python3.11 Copr project. Is this expected?

Comment 3 Miro Hrončok 2021-11-03 15:19:24 UTC
Yes, this is expected. We build the packages in order and we attempted a rebuild of pycurl when it was possible. The new dependency means we will only be able to rebuild pycurl later.

Comment 4 Lukáš Zaoral 2021-11-29 13:55:50 UTC
Some tests now fail due to dependency on python3-bottle which is broken at the moment (bug 2021856):

ImportError while importing test module '/builddir/build/BUILD/pycurl-7.44.1/tests/cadata_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/cadata_test.py:12: in <module>
    setup_module, teardown_module = appmanager.setup(('app', 8384, dict(ssl=True)))
tests/appmanager.py:10: in setup
    return perform_setup(*specs)
tests/appmanager.py:13: in perform_setup
    from . import runwsgi
tests/runwsgi.py:3: in <module>
>   import bottle
>/usr/lib/python3.11/site-packages/bottle.py:43: in <module>
>   from inspect import getargspec
>E  ImportError: cannot import name 'getargspec' from 'inspect' (/usr/lib64/python3.11/inspect.py)

Comment 5 Ben Cotton 2022-02-08 21:24:38 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.

Comment 6 Tomáš Hrnčiar 2022-02-10 14:17:51 UTC
Removal of unittest aliases was reverted in Python 3.11 and will be part of Python 3.12, so the above failure is not present anymore, thus I am closing this bugzilla. However, this will be needed next year though so I encourage you to communicate with the upstream about it.

Comment 7 Tomáš Hrnčiar 2022-02-10 14:18:24 UTC
Removal of unittest aliases was reverted in Python 3.11 and will be part of Python 3.12, so the above failure is not present anymore, thus I am closing this bugzilla. However, this will be needed next year though so I encourage you to communicate with the upstream about it.

Comment 8 Lukáš Zaoral 2022-02-10 14:32:34 UTC
The patch fixing this issue included in python-pycurl-7.44.1-4.fc36 was taken from upstream: https://github.com/pycurl/pycurl/commit/41728025340a02643085adcbcecf986ad8667209