[FIX] base: fix test failing when sources are not in a folder named

'odoo'

-EX: odoo addons path is '~/odoo15/odoo/...' or '~/15.0/odoo/...'
Basically not start with 'odoo' it will get error when running tests
case on this file

closes odoo/odoo#109135

X-original-commit: 336b966f7959b4a5e716b58b25ab13d7e3f92691
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
This commit is contained in:
duongnguyen
2023-01-06 11:25:02 +01:00
parent b35af33ffb
commit b17533c9f9
+2 -2
View File
@@ -123,12 +123,12 @@ class TestRunnerLoggingCommon(TransactionCase):
self.test_result.addError(self, (AssertionError, AssertionError(message), None))
def _clean_message(self, message):
root_path = __file__.replace('/odoo/odoo/addons/base/tests/test_test_suite.py', '')
root_path = __file__.replace('/odoo/addons/base/tests/test_test_suite.py', '')
message = re.sub(r'line \d+', 'line $line', message)
message = re.sub(r'py:\d+', 'py:$line', message)
message = re.sub(r'decorator-gen-\d+', 'decorator-gen-xxx', message)
message = re.sub(r'python[\d\.]+', 'python', message)
message = message.replace(f'{root_path}', '/root_path')
message = message.replace(f'{root_path}', '/root_path/odoo')
return message