diff --git a/frappe/commands/testing.py b/frappe/commands/testing.py
index 78468b0fd3..394b4c29cf 100644
--- a/frappe/commands/testing.py
+++ b/frappe/commands/testing.py
@@ -159,11 +159,14 @@ def main(
discover_all_tests(apps, runner)
results = []
+ global unittest_runner
for app, category, suite in runner.iterRun():
click.secho(
f"\nRunning {suite.countTestCases()} {category} tests for {app}", fg="cyan", bold=True
)
- results.append([app, category, runner.run(suite)])
+ main_runner = unittest_runner if junit_xml_output and unittest_runner else runner
+ res = main_runner.run(suite)
+ results.append([app, category, res])
success = all(r.wasSuccessful() for _, _, r in results)
if not success:
diff --git a/frappe/core/doctype/translation/test_translation.py b/frappe/core/doctype/translation/test_translation.py
index 7a28d068d3..0da71d3dc8 100644
--- a/frappe/core/doctype/translation/test_translation.py
+++ b/frappe/core/doctype/translation/test_translation.py
@@ -16,16 +16,20 @@ class TestTranslation(IntegrationTestCase):
clear_cache()
def test_doctype(self):
- translation_data = get_translation_data()
- for lang, (source_string, new_translation) in translation_data.items():
+ doctype = "Translation"
+ meta = frappe.get_meta(doctype)
+ source_string = meta.get_label("translated_text")
+
+ for lang in ["de", "bs", "zh", "hr", "en", "sv"]:
frappe.local.lang = lang
- original_translation = _(source_string)
+ original_translation = _(source_string, context=doctype)
+ new_translation = f"{original_translation} Customized"
- docname = create_translation(lang, source_string, new_translation)
- self.assertEqual(_(source_string), new_translation)
+ docname = create_translation(lang, source_string, new_translation, context=doctype)
+ self.assertEqual(_(source_string, context=doctype), new_translation)
- frappe.delete_doc("Translation", docname)
- self.assertEqual(_(source_string), original_translation)
+ frappe.delete_doc(doctype, docname)
+ self.assertEqual(_(source_string, context=doctype), original_translation)
def test_parent_language(self):
data = {
@@ -60,37 +64,54 @@ class TestTranslation(IntegrationTestCase):
source = "User"
self.assertNotEqual(_(source, lang="de"), _(source, lang="es"))
- def test_html_content_data_translation(self):
- # ruff: noqa: RUF001
+ def test_html_content_translation(self):
source = """
- MacBook Air lasts up to an incredible 12 hours between charges. So from your morning coffee to
- your evening commute, you can work unplugged. When it’s time to kick back and relax,
- you can get up to 12 hours of iTunes movie playback. And with up to 30 days of standby time,
- you can go away for weeks and pick up where you left off.Whatever the task,
- fifth-generation Intel Core i5 and i7 processors with Intel HD Graphics 6000 are up to it.
- """
-
+ To add dynamic subject, use jinja tags like
+
{{ doc.name }} Billed{{ doc.name }} Abgerechnet