summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Lejeune <sle@openerp.com>2019-07-11 15:01:27 +0000
committerSimon Lejeune <sle@openerp.com>2019-07-12 07:14:38 +0000
commit22221a2b573a4daad9457bb2329a84bcef15d5df (patch)
tree3f0c55259078e6fe73d9e280f667643f596b62b1
parent50163143a915635eda08dc1f053e057c38871f42 (diff)
[REF] server: better warnings when using --test-file
We add two warnings to make the --test-file argument more user friendly: - one when the test file does not exist example: ./odoo-bin -d master --test-file ./addonss/stock/tests/test_quant.py before: INFO master odoo.service.server: loading test file ./addonss/stock/tests/test_quant.py after: WARNING master odoo.service.server: test file ./addonss/stock/tests/test_quant.py cannot be found - one when the test file is not a python file In both cases, nothing was being tested but the server did not say why. closes odoo/odoo#34808 Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
-rw-r--r--odoo/service/server.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/odoo/service/server.py b/odoo/service/server.py
index 207d590e724..7fd576ab6d5 100644
--- a/odoo/service/server.py
+++ b/odoo/service/server.py
@@ -1123,9 +1123,13 @@ def preload_registries(dbnames):
# run test_file if provided
if config['test_file']:
test_file = config['test_file']
- _logger.info('loading test file %s', test_file)
- with odoo.api.Environment.manage():
- if test_file.endswith('py'):
+ if not os.path.isfile(test_file):
+ _logger.warning('test file %s cannot be found', test_file)
+ elif not test_file.endswith('py'):
+ _logger.warning('test file %s is not a python file', test_file)
+ else:
+ _logger.info('loading test file %s', test_file)
+ with odoo.api.Environment.manage():
load_test_file_py(registry, test_file)
# run post-install tests