From 36d2afb046d44b65e222080b7e878eb30bcb00d4 Mon Sep 17 00:00:00 2001 From: Julien Thewys Date: Wed, 17 Nov 2010 11:46:01 +0100 Subject: [PATCH] [IMP] Added 'test_force' cli param for loading tests without demo data. Sometimes you want tests to be run against an environment where no demo data are allowed and you do not want to have tests loaded from the 'data' section as records will not be rolled back. bzr revid: jth@openerp.com-20101117104601-jottg84dmss716r0 --- bin/addons/__init__.py | 2 ++ bin/tools/config.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index 0b5c6dc09c5..572a9e0ba86 100644 --- a/bin/addons/__init__.py +++ b/bin/addons/__init__.py @@ -738,6 +738,8 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, **kwargs): # 'data' section, but should probably not alter the data, # as there is no rollback. load_test(cr, m, idref, mode) + elif tools.config.options['test_force']: + load_test(cr, m, idref, mode) package_todo.append(package.name) diff --git a/bin/tools/config.py b/bin/tools/config.py index f98cdbab1b9..fd1d8c41cba 100644 --- a/bin/tools/config.py +++ b/bin/tools/config.py @@ -85,6 +85,7 @@ class configmanager(object): 'test_file' : False, 'test_report_directory' : False, 'test_disable' : False, + 'test_force' : False, 'test_commit' : False, 'static_http_enable': False, 'static_http_document_root': None, @@ -162,6 +163,8 @@ class configmanager(object): group.add_option("--test-report-directory", dest="test_report_directory", help="If set, will save sample of all reports in this directory.") group.add_option("--test-disable", action="store_true", dest="test_disable", default=False, help="Disable loading test files.") + group.add_option("--force-test", action="store_true", dest="test_force", + default=False, help="Forces loading of test files (even if --without-demo).") group.add_option("--test-commit", action="store_true", dest="test_commit", default=False, help="Commit database changes performed by tests.") parser.add_option_group(group) @@ -285,7 +288,7 @@ class configmanager(object): 'language', 'translate_out', 'translate_in', 'debug_mode', 'smtp_ssl', 'stop_after_init', 'logrotate', 'without_demo', 'netrpc', 'xmlrpc', 'syslog', 'list_db', 'xmlrpcs', - 'test_file', 'test_disable', 'test_commit', 'test_report_directory' + 'test_file', 'test_disable', 'test_force', 'test_commit', 'test_report_directory' ] for arg in keys: