Files
erpnext/erpnext/tests/test_perf.py
ruthra kumar f1dfac417d refactor: replace IntegrationTestCase with ERPNextTestCase repo-wide
- import ERPNextTestSuite
 - use it on test class
2026-03-19 12:57:07 +05:30

25 lines
681 B
Python

import frappe
from erpnext.tests.utils import ERPNextTestSuite
INDEXED_FIELDS = {
"Bin": ["item_code"],
"GL Entry": ["voucher_no", "posting_date", "company", "party"],
"Purchase Order Item": ["item_code"],
}
class TestPerformance(ERPNextTestSuite):
def test_ensure_indexes(self):
# These fields are not explicitly indexed BUT they are prefix in some
# other composite index. If those are removed this test should be
# updated accordingly.
for doctype, fields in INDEXED_FIELDS.items():
for field in fields:
self.assertTrue(
frappe.db.sql(
f"""SHOW INDEX FROM `tab{doctype}`
WHERE Column_name = "{field}" AND Seq_in_index = 1"""
)
)