frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
21.87k stars 7.33k forks source link

Reimplement TestItemGroup on top of TestNestedSet #37546

Closed bosue closed 8 months ago

bosue commented 1 year ago

Information about bug

test_item_group.py should use frappe/tests/test_nestedset.py as a base class and inherit its extensive tests, instead of doing the same all over again.

For one or two tree doctypes, this may not matter all too much, but will later vastly improve maintenance and testing of further tree doctypes. Also, this way we‘re backtesting the base test class.

class TestItem(unittest.TestCase):
    def test_basic_tree(self, records=None):
        min_lft = 1
        max_rgt = frappe.db.sql("select max(rgt) from `tabItem Group`")[0][0]

Also, our class name should be TestItemGroup here.

Module

other

Version

Frappe / ERPNext: dev

Installation method

None

Relevant log output / Stack trace / Full Error Message.

No response

Nihantra-Patel commented 8 months ago

Duplicate issue: #37547