Bug 2175195

Summary: python-httmock fails to build with Python 3.12: AttributeError: 'RememberCalledTest' object has no attribute 'assertEquals'
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-httmockAssignee: Steve Traylen <steve.traylen>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: mhroncok, steve.traylen, thrnciar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-httmock-1.4.0-9.fc39 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-05 20:28:05 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: 2135404    

Description Tomáš Hrnčiar 2023-03-03 14:10:08 UTC
python-httmock fails to build with Python 3.12.0a5.

=================================== FAILURES ===================================
________________ RememberCalledTest.test_several_call_decorated ________________

self = <tests.RememberCalledTest testMethod=test_several_call_decorated>

    @with_httmock(google_mock_count, facebook_mock_count)
    def test_several_call_decorated(self):
        results = self.several_calls(3, requests.get, 'http://facebook.com/')
    
        self.assertTrue(facebook_mock_count.call['called'])
        self.assertEqual(facebook_mock_count.call['count'], 3)
    
        self.assertFalse(google_mock_count.call['called'])
        self.assertEqual(google_mock_count.call['count'], 0)
    
        for r in results:
            self.assertEqual(r.content, b'Hello from Facebook')
    
        self.several_calls(1, requests.get, 'http://facebook.com/')
>       self.assertEquals(facebook_mock_count.call['count'], 4)
E       AttributeError: 'RememberCalledTest' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

tests.py:360: AttributeError
____________________ RememberCalledTest.test_several_calls _____________________

self = <tests.RememberCalledTest testMethod=test_several_calls>

    def test_several_calls(self):
        with HTTMock(google_mock_count, facebook_mock_count):
            results = self.several_calls(
                3, requests.get, 'http://facebook.com/')
    
        self.assertTrue(facebook_mock_count.call['called'])
        self.assertEqual(facebook_mock_count.call['count'], 3)
    
        self.assertFalse(google_mock_count.call['called'])
        self.assertEqual(google_mock_count.call['count'], 0)
    
        for r in results:
            self.assertEqual(r.content, b'Hello from Facebook')
    
        # Negative case: cleanup call data
        with HTTMock(facebook_mock_count):
            results = self.several_calls(
                1, requests.get, 'http://facebook.com/')
    
>       self.assertEquals(facebook_mock_count.call['count'], 1)
E       AttributeError: 'RememberCalledTest' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

tests.py:344: AttributeError
=========================== short test summary info ============================
FAILED tests.py::RememberCalledTest::test_several_call_decorated - AttributeE...
FAILED tests.py::RememberCalledTest::test_several_calls - AttributeError: 'Re...
========================= 2 failed, 28 passed in 0.15s =========================
py312: exit 1 (0.33 seconds) /builddir/build/BUILD/httmock-1.4.0> /usr/bin/python3 -b -m pytest -W always tests.py pid=179
  py312: FAIL code 1 (0.34=setup[0.01]+cmd[0.33] seconds)
  evaluation failed :( (0.38 seconds)

RPM build errors:

Removed many old deprecated unittest features:

    - A number of TestCase method aliases:

    | Deprecated alias      |  Method Name           | Deprecated in |
    +-----------------------|------------------------|---------------+
    | failUnless            | assertTrue()           |      3.1      |
    | failIf                | assertFalse()          |      3.1      |
    | failUnlessEqual       | assertEqual()          |      3.1      |
    | failIfEqual           | assertNotEqual()       |      3.1      |
    | failUnlessAlmostEqual | assertAlmostEqual()    |      3.1      |
    | failIfAlmostEqual     | assertNotAlmostEqual() |      3.1      |
    | failUnlessRaises      | assertRaises()         |      3.1      |
    | assert_               | assertTrue()           |      3.2      |
    | assertEquals          | assertEqual()          |      3.2      |
    | assertNotEquals       | assertNotEqual()       |      3.2      |
    | assertAlmostEquals    | assertAlmostEqual()    |      3.2      |
    | assertNotAlmostEquals | assertNotAlmostEqual() |      3.2      |
    | assertRegexpMatches   | assertRegex()          |      3.2      |
    | assertRaisesRegexp    | assertRaisesRegex()    |      3.2      |
    | assertNotRegexpMatches| assertNotRegex()       |      3.5      |
    +-----------------------|------------------------|---------------+

    You can use https://github.com/isidentical/teyit to automatically modernise your unit tests.

    - Undocumented and broken TestCase method assertDictContainsSubset (deprecated in Python 3.2).

    - Undocumented TestLoader.loadTestsFromModule parameter use_load_tests (deprecated and ignored since Python 3.2).

    - An alias of the TextTestResult class: _TextTestResult (deprecated in Python
3.2).

(Contributed by Serhiy Storchaka in bpo-45162.)
https://bugs.python.org/issue?@action=redirect&bpo=45162



https://docs.python.org/3.12/whatsnew/3.12.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.12/fedora-rawhide-x86_64/05576156-python-httmock/

For all our attempts to build python-httmock with Python 3.12, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/package/python-httmock/

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

Let us know here if you have any questions.

Python 3.12 is planned to be included in Fedora 39. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.12.
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 Fedora Update System 2023-05-05 20:25:15 UTC
FEDORA-2023-49275a1df6 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-49275a1df6

Comment 2 Steve Traylen 2023-05-05 20:28:05 UTC
python-httmock-1.4.0-9.fc39.src.rpm now uses the correct tests.py matching this released where situation was already resolved.

Comment 3 Fedora Update System 2023-05-05 20:28:24 UTC
FEDORA-2023-49275a1df6 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.