From 2eaaa0614dde4818fdccbc014c6f09147de26a57 Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Mon, 6 Sep 2021 16:32:12 +0000 Subject: [PATCH] [IMP] tests: improve subtest failure message When a subtest fails, the failure message maybe a bit cryptic like `Fail: Subtest (login=admin)` With this commit, the parent test case and test method are displayed too. closes odoo/odoo#76046 Signed-off-by: Xavier Morel (xmo) --- odoo/tests/runner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/tests/runner.py b/odoo/tests/runner.py index bf2680b90a7..dfb4f167ad7 100644 --- a/odoo/tests/runner.py +++ b/odoo/tests/runner.py @@ -59,7 +59,7 @@ class OdooTestResult(unittest.result.TestResult): def getDescription(self, test): if isinstance(test, unittest.case._SubTest): - return 'Subtest %s' % test._subDescription() + return 'Subtest %s.%s %s' % (test.test_case.__class__.__qualname__, test.test_case._testMethodName, test._subDescription()) if isinstance(test, unittest.TestCase): # since we have the module name in the logger, this will avoid to duplicate module info in log line # we only apply this for TestCase since we can receive error handler or other special case