Bug 2175147

Summary: python-alarmdecoder fails to build with Python 3.12: AttributeError: 'TestAlarmDecoder' object has no attribute 'assertEquals'.
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-alarmdecoderAssignee: Fabian Affolter <mail>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 39CC: mail, mhroncok, thrnciar
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: 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 11:06:16 UTC
python-alarmdecoder fails to build with Python 3.12.0a5.


=================================== FAILURES ===================================
_____________________ TestAlarmDecoder.test_config_message _____________________

self = <test_ad2.TestAlarmDecoder testMethod=test_config_message>

    def test_config_message(self):
        msg = self._decoder._handle_message(b'!CONFIG>MODE=A&CONFIGBITS=ff04&ADDRESS=18&LRR=N&COM=N&EXP=NNNNN&REL=NNNN&MASK=ffffffff&DEDUPLICATE=N')
>       self.assertEquals(self._decoder.mode, ADEMCO)
E       AttributeError: 'TestAlarmDecoder' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

test/test_ad2.py:232: AttributeError
_________________ TestAlarmDecoder.test_zone_fault_and_restore _________________

self = <test_ad2.TestAlarmDecoder testMethod=test_zone_fault_and_restore>

    def test_zone_fault_and_restore(self):
        self._decoder._on_read(self, data=b'[00010001000000000A--],003,[f70000051003000008020000000000],"FAULT 03                        "')
>       self.assertEquals(self._zone_faulted, 3)
E       AttributeError: 'TestAlarmDecoder' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

test/test_ad2.py:357: AttributeError
_______________________ TestSerialDevice.test_read_line ________________________

self = <test_devices.TestSerialDevice testMethod=test_read_line>

    def test_read_line(self):
        side_effect = list("testing\r\n")
        if sys.version_info > (3,):
            side_effect = [chr(x).encode('utf-8') for x in b"testing\r\n"]
    
        with patch.object(self._device._device, 'read', side_effect=side_effect):
            with patch('serial.Serial.fileno', return_value=1):
                with patch.object(select, 'select', return_value=[[1], [], []]):
                    ret = None
                    try:
                        ret = self._device.read_line()
                    except StopIteration:
                        pass
    
>                   self.assertEquals(ret, "testing")
E                   AttributeError: 'TestSerialDevice' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

test/test_devices.py:112: AttributeError
_______________________ TestSocketDevice.test_read_line ________________________

self = <test_devices.TestSocketDevice testMethod=test_read_line>

    def test_read_line(self):
        side_effect = list("testing\r\n")
        if sys.version_info > (3,):
            side_effect = [chr(x).encode('utf-8') for x in b"testing\r\n"]
    
        with patch('socket.socket.fileno', return_value=1):
            with patch.object(select, 'select', return_value=[[1], [], []]):
                with patch.object(self._device._device, 'recv', side_effect=side_effect):
                    ret = None
                    try:
                        ret = self._device.read_line()
                    except StopIteration:
                        pass
    
>           self.assertEquals(ret, "testing")
E           AttributeError: 'TestSocketDevice' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

test/test_devices.py:207: AttributeError
__________________ TestMessages.test_lrr_event_code_override ___________________

self = <test_messages.TestMessages testMethod=test_lrr_event_code_override>

    def test_lrr_event_code_override(self):
        msg = LRRMessage('!LRR:001,1,CID_3400,01')
>       self.assertEquals(msg.event_code, LRR_CID_EVENT.OPENCLOSE_BY_USER)  # 400 -> 401
E       AttributeError: 'TestMessages' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

test/test_messages.py:88: AttributeError
____________________ TestMessages.test_lrr_message_parse_v2 ____________________

self = <test_messages.TestMessages testMethod=test_lrr_message_parse_v2>

    def test_lrr_message_parse_v2(self):
        msg = LRRMessage('!LRR:001,1,CID_3401,ff')
        self.assertIsInstance(msg, LRRMessage)
>       self.assertEquals(msg.event_data, '001')
E       AttributeError: 'TestMessages' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

test/test_messages.py:78: AttributeError
=========================== short test summary info ============================
FAILED test/test_ad2.py::TestAlarmDecoder::test_config_message - AttributeErr...
FAILED test/test_ad2.py::TestAlarmDecoder::test_zone_fault_and_restore - Attr...
FAILED test/test_devices.py::TestSerialDevice::test_read_line - AttributeErro...
FAILED test/test_devices.py::TestSocketDevice::test_read_line - AttributeErro...
FAILED test/test_messages.py::TestMessages::test_lrr_event_code_override - At...
FAILED test/test_messages.py::TestMessages::test_lrr_message_parse_v2 - Attri...
================== 6 failed, 62 passed, 2 deselected in 0.41s ==================

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/05573765-python-alarmdecoder/

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

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 Release Engineering 2023-08-16 07:10:36 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.