From 03ecd2fd3a21ef8f5d7085861967ce21b1cb59a2 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 26 Jun 2026 13:36:39 +0530 Subject: [PATCH] test: reuse BootStrapTestData master data to reduce runtime Co-Authored-By: Claude Opus 4.8 (1M context) --- .../test_profitability_analysis.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/report/profitability_analysis/test_profitability_analysis.py b/erpnext/accounts/report/profitability_analysis/test_profitability_analysis.py index 453587dbf9f..19e0c57ceb2 100644 --- a/erpnext/accounts/report/profitability_analysis/test_profitability_analysis.py +++ b/erpnext/accounts/report/profitability_analysis/test_profitability_analysis.py @@ -41,10 +41,13 @@ class TestProfitabilityAnalysis(ERPNextTestSuite): ) def book_expense(self, cost_center, amount, posting_date="2026-06-01"): - make_journal_entry(EXPENSE, BANK, amount, cost_center=cost_center, posting_date=posting_date, submit=True) + make_journal_entry( + EXPENSE, BANK, amount, cost_center=cost_center, posting_date=posting_date, submit=True + ) def test_income_expense_and_gross_profit(self): - cc = self.make_cc("_Test PA Leaf") + # bootstrap leaf cost center; clean of committed GL so exact assertions hold + cc = "_Test Cost Center - _TC" self.book_income(cc, 10000) self.book_expense(cc, 4000) @@ -71,7 +74,7 @@ class TestProfitabilityAnalysis(ERPNextTestSuite): self.assertEqual(parent_row["gross_profit_loss"], 7000) def test_date_range_excludes_out_of_period_entries(self): - cc = self.make_cc("_Test PA Date") + cc = "_Test Cost Center 2 - _TC" self.book_income(cc, 10000, posting_date="2025-06-01") # the 2025 income must not appear in a 2026 report (zero-value rows are dropped) @@ -87,7 +90,7 @@ class TestProfitabilityAnalysis(ERPNextTestSuite): self.assertEqual(row_2025["income"], 10000) def test_total_row_sums_income_and_expense(self): - cc = self.make_cc("_Test PA Total") + cc = "_Test Cost Center - _TC" self.book_income(cc, 10000) self.book_expense(cc, 4000)