summaryrefslogtreecommitdiff
path: root/openerp/cli/server.py
diff options
context:
space:
mode:
authorKersten Jeremy <jke@openerp.com>2014-03-19 11:48:47 +0100
committerKersten Jeremy <jke@openerp.com>2014-03-19 11:48:47 +0100
commit903270996f6ac6b643e7a79ea675b9542cf7ca4c (patch)
treeb5856cf5963ae69d94cc2b432a664d20a9feeb9f /openerp/cli/server.py
parent1225c8b530415360e95afa44da7cc82457fd1b88 (diff)
[FIX] Fix the yml test with option --test-file.
1 - There was a confusing between kind and mode. Due to the mode 'test', there are many part of code who was not executed. The right value is kind='test', and arbitrary mode='init' (or 'update') 2 - The yml test was always roolbacked, without check that command line had '--test-commit'. It's has been fixed, now we check if param --test-commit is existing, else we roolback the transaction. Rem for forward: function in trunk=saas-4 has been moved in : openerp/service/server.py - def load_test_file_yml bzr revid: jke@openerp.com-20140319104847-6r2c70gapocn2wxq
Diffstat (limited to 'openerp/cli/server.py')
-rw-r--r--openerp/cli/server.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/openerp/cli/server.py b/openerp/cli/server.py
index 943ce9a53a8..ec5516a4786 100644
--- a/openerp/cli/server.py
+++ b/openerp/cli/server.py
@@ -105,8 +105,15 @@ def run_test_file(dbname, test_file):
db, registry = openerp.pooler.get_db_and_pool(dbname, update_module=config['init'] or config['update'])
cr = db.cursor()
_logger.info('loading test file %s', test_file)
- openerp.tools.convert_yaml_import(cr, 'base', file(test_file), 'test', {}, 'test', True)
- cr.rollback()
+ openerp.tools.convert_yaml_import(cr, 'base', file(test_file), 'test', {}, 'init')
+
+ if config['test_commit']:
+ _logger.info('test %s has been commited', test_file)
+ cr.commit()
+ else:
+ _logger.info('test %s has been rollbacked', test_file)
+ cr.rollback()
+
cr.close()
except Exception:
_logger.exception('Failed to initialize database `%s` and run test file `%s`.', dbname, test_file)