Bug 2034167 - python-liblarch fails to build with Python 3.11: AttributeError: 'TestLibLarch' object has no attribute 'assert_'
Summary: python-liblarch fails to build with Python 3.11: AttributeError: 'TestLibLarc...
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Fedora
Classification: Fedora
Component: python-liblarch
Version: 36
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miguel
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.11
TreeView+ depends on / blocked
 
Reported: 2021-12-20 09:55 UTC by Tomáš Hrnčiar
Modified: 2022-02-10 14:31 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-02-10 14:31:33 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2021-12-20 09:55:40 UTC
python-liblarch fails to build with Python 3.11.0a3.


=================================== FAILURES ===================================
_________________________ TestLibLarch.test_green_leaf _________________________

self = <tests.test_liblarch.TestLibLarch testMethod=test_green_leaf>

    def test_green_leaf(self):
        """We apply a green and leaf filter then we remove the green
        from one of the leaf node and the green parent should be displayed"""
        def green_leaf(node):
            # We return False if one child is green
            for c in node.get_children():
                cnode = self.tree.get_node(c)
                if cnode.has_color('green'):
                    return False
            return node.has_color('green')
        self.tree.add_filter('green_leaf', green_leaf)
        view = self.tree.get_viewtree(refresh=False)
        test = TreeTester(view)
        view.apply_filter('green_leaf')
        self.assertEqual(1, view.get_n_nodes())
        nid = view.get_node_for_path(('14', ))
        # Now, we add a new node
        node = DummyNode('temp')
        node.add_color('green')
        self.tree.add_node(node, parent_id='14')
        self.assertEqual(1, view.get_n_nodes())
        nid = view.get_node_for_path(('temp', ))
        self.assertEqual('temp', nid)
        # Only one node should be there
        self.assertEqual(1, view.get_n_nodes())
        # 14 should not be there
        self.assertFalse(view.is_displayed('14'))
        # Now we remove 'temp' from the tree
        node.remove_color('green')
        self.assertEqual(1, view.get_n_nodes())
>       self.assert_(view.is_displayed('14'))
E       AttributeError: 'TestLibLarch' object has no attribute 'assert_'

tests/test_liblarch.py:1186: AttributeError
________________________ TestLibLarch.test_leaf_filter _________________________

self = <tests.test_liblarch.TestLibLarch testMethod=test_leaf_filter>

    def test_leaf_filter(self):
        view = self.tree.get_viewtree(refresh=False)
        test = TreeTester(view)
        """Test filtering to show only the leaf nodes.
    
        When the 'leaf' filter is applied and a child added to a node,
        the parent node should not be present in the results.
        """
        view.apply_filter('leaf')
        total = self.red_nodes + self.blue_nodes
        self.assertEqual(total, view.get_n_nodes())
        view.apply_filter('green')
        self.assertEqual(1, view.get_n_nodes())
        nid = view.get_node_for_path(('14', ))
        # Now, we add a new node
        node = DummyNode('temp')
        node.add_color('green')
        self.tree.add_node(node, parent_id='14')
        self.assertEqual(1, view.get_n_nodes())
        nid = view.get_node_for_path(('temp', ))
        self.assertEqual('temp', nid)
        # Only one node should be there
        self.assertEqual(1, view.get_n_nodes())
        # 14 should not be there
        self.assertFalse(view.is_displayed('14'))
        # Now we remove 'temp' from the tree
        self.tree.del_node('temp')
        self.assertEqual(1, view.get_n_nodes())
>       self.assert_(view.is_displayed('14'))
E       AttributeError: 'TestLibLarch' object has no attribute 'assert_'

tests/test_liblarch.py:1153: AttributeError
_____________________ TestLibLarch.test_node_count_update ______________________

self = <tests.test_liblarch.TestLibLarch testMethod=test_node_count_update>

    def test_node_count_update(self):
        """this is for the @t @ta @tag bug"""
        def filter_func(node):
            # we display a color in tagtree only if
            # this color has at least one node in self.tree
            color = node.get_id()
            viewcount = self.tree.get_viewcount(name=color, refresh=True)
            count = viewcount.get_n_nodes()
            return count > 0
        # self.tree is where we will store "tasks" (here colors)
        # the main tree will be the tag tree.
        tagtree = Tree()
        blue_tag = CountNode("blue", self.tree)
        tagtree.add_node(blue_tag)
        green_tag = CountNode("green", self.tree)
        tagtree.add_node(green_tag)
        red_tag = CountNode("red", self.tree)
        tagtree.add_node(red_tag)
        tagtree.add_filter("color_exists", filter_func)
        view = tagtree.get_viewtree()
        view.apply_filter("color_exists")
>       self.assert_(view.is_displayed("red"))
E       AttributeError: 'TestLibLarch' object has no attribute 'assert_'

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/03053461-python-liblarch/

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

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 Ben Cotton 2022-02-08 21:20:27 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.

Comment 2 Tomáš Hrnčiar 2022-02-10 14:31:33 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.


Note You need to log in before you can comment on or make changes to this bug.