Bug 2175191

Summary: python-parsley fails to build with Python 3.12: AttributeError: 'PythonWriterTests' object has no attribute 'assert_'
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-parsleyAssignee: Luis Bazan <bazanluis20>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 39CC: bazanluis20, mhroncok, thrnciar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-parsley-1.3-28.fc39 python-parsley-1.3-28.fc40 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-08-17 04:18:38 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:03:10 UTC
python-parsley fails to build with Python 3.12.0a5.

=================================== FAILURES ===================================
______________________ PythonWriterTests.test_markAsTree _______________________

self = <ometa.test.test_builder.PythonWriterTests testMethod=test_markAsTree>

    def test_markAsTree(self):
        """
        Grammars containing list patterns are marked as taking
        tree-shaped input rather than character streams.
        """
        x = t.Rule("foo", t.List(
                t.Exactly("x")))
        g = t.Grammar("TestGrammar", True, [x])
>       self.assert_("\n        tree = True\n" in writePython(g, ""))
E       AttributeError: 'PythonWriterTests' object has no attribute 'assert_'. Did you mean: 'assertIn'?

ometa/test/test_builder.py:328: AttributeError
______________ ParserProtocolTestCase.test_connectionEstablishes _______________

self = <ometa.test.test_protocol.ParserProtocolTestCase testMethod=test_connectionEstablishes>

    def test_connectionEstablishes(self):
        """prepareParsing is called on the receiver after connection establishment."""
        self.protocol.makeConnection(None)
>       self.assert_(self.protocol.receiver.connected)
E       AttributeError: 'ParserProtocolTestCase' object has no attribute 'assert_'. Did you mean: 'assertIn'?

ometa/test/test_protocol.py:93: AttributeError
__________ ParserProtocolTestCase.test_dataIgnoredAfterDisconnection ___________

self = <ometa.test.test_protocol.ParserProtocolTestCase testMethod=test_dataIgnoredAfterDisconnection>

    def test_dataIgnoredAfterDisconnection(self):
        """After connectionLost is called, all incoming data is ignored."""
        transport = FakeTransport()
        self.protocol.makeConnection(transport)
        reason = object()
        self.protocol.connectionLost(reason)
        self.protocol.dataReceived('d')
        self.assertEqual(self.protocol.receiver.lossReason, reason)
>       self.assert_(not transport.aborted)
E       AttributeError: 'ParserProtocolTestCase' object has no attribute 'assert_'. Did you mean: 'assertIn'?

ometa/test/test_protocol.py:190: AttributeError
___________ ParserProtocolTestCase.test_exceptionsRaisedFromReceiver ___________

self = <ometa.test.test_protocol.ParserProtocolTestCase testMethod=test_exceptionsRaisedFromReceiver>

    def test_exceptionsRaisedFromReceiver(self):
        """
        Raising an exception from receiver methods called from the grammar
        propagate to finishParsing.
        """
        transport = FakeTransport()
        self.protocol.makeConnection(transport)
        self.protocol.dataReceived('e')
>       self.failIfEqual(self.protocol.receiver.lossReason, None)
E       AttributeError: 'ParserProtocolTestCase' object has no attribute 'failIfEqual'

ometa/test/test_protocol.py:177: AttributeError
___________________ ParserProtocolTestCase.test_parseFailure ___________________

self = <ometa.test.test_protocol.ParserProtocolTestCase testMethod=test_parseFailure>

    def test_parseFailure(self):
        """
        Parse failures cause connection abortion with the parse error as the
        reason.
        """
        transport = FakeTransport()
        self.protocol.makeConnection(transport)
        self.protocol.dataReceived('b')
>       self.failIfEqual(self.protocol.receiver.lossReason, None)
E       AttributeError: 'ParserProtocolTestCase' object has no attribute 'failIfEqual'

ometa/test/test_protocol.py:164: AttributeError
______________________ MakeGrammarTest.test_brokenGrammar ______________________

self = <ometa.test.test_pymeta.MakeGrammarTest testMethod=test_brokenGrammar>

    def test_brokenGrammar(self):
        grammar = """
        andHandler = handler:h1 'and handler:h2 -> And(h1, h2)
        """
        e = self.assertRaises(ParseError, OMeta.makeGrammar, grammar,
                              "Foo")
>       self.assertEquals(e.position, 57)
E       AttributeError: 'MakeGrammarTest' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

ometa/test/test_pymeta.py:1141: AttributeError
________________________ RuntimeTests.test_exactlyFail _________________________

self = <ometa.test.test_runtime.RuntimeTests testMethod=test_exactlyFail>

    def test_exactlyFail(self):
        """
        L{OMetaBase.rule_exactly} raises L{ParseError} when the requested item
        doesn't match the input. The error contains info on what was expected
        and the position.
        """
    
        data = "foo"
        o = OMetaBase(data)
        exc = self.assertRaises(ParseError, o.rule_exactly, "g")
>       self.assertEquals(exc.args[1], expected(None, "g"))
E       AttributeError: 'RuntimeTests' object has no attribute 'assertEquals'. Did you mean: 'assertEqual'?

ometa/test/test_runtime.py:57: AttributeError
=========================== short test summary info ============================
FAILED ometa/test/test_builder.py::PythonWriterTests::test_markAsTree - Attri...
FAILED ometa/test/test_protocol.py::ParserProtocolTestCase::test_connectionEstablishes
FAILED ometa/test/test_protocol.py::ParserProtocolTestCase::test_dataIgnoredAfterDisconnection
FAILED ometa/test/test_protocol.py::ParserProtocolTestCase::test_exceptionsRaisedFromReceiver
FAILED ometa/test/test_protocol.py::ParserProtocolTestCase::test_parseFailure
FAILED ometa/test/test_pymeta.py::MakeGrammarTest::test_brokenGrammar - Attri...
FAILED ometa/test/test_runtime.py::RuntimeTests::test_exactlyFail - Attribute...
=================== 7 failed, 273 passed, 8 skipped in 2.75s ===================

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/05583069-python-parsley/

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

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:45 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.

Comment 2 Fedora Update System 2023-08-17 04:18:12 UTC
FEDORA-2023-82c24d9811 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-82c24d9811

Comment 3 Fedora Update System 2023-08-17 04:18:24 UTC
FEDORA-2023-c1448a4f19 has been submitted as an update to Fedora 40. https://bodhi.fedoraproject.org/updates/FEDORA-2023-c1448a4f19

Comment 4 Fedora Update System 2023-08-17 04:18:38 UTC
FEDORA-2023-82c24d9811 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 5 Fedora Update System 2023-08-17 04:18:46 UTC
FEDORA-2023-c1448a4f19 has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.