From d09c24a894822bee7f65d20d28f130a74d95ef23 Mon Sep 17 00:00:00 2001 From: Nathanael Perat Date: Mon, 31 Oct 2011 14:54:13 +0100 Subject: [PATCH] fixed -c option to test_tryton.py issue 2121 review 154006 --- trytond/tests/test_tryton.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/trytond/tests/test_tryton.py b/trytond/tests/test_tryton.py index c91f496b39..ed09b930d0 100644 --- a/trytond/tests/test_tryton.py +++ b/trytond/tests/test_tryton.py @@ -15,16 +15,29 @@ import doctest from lxml import etree import time import imp +import optparse _MODULES = False +_CONFIGFILE = None if __name__ == '__main__': - if '--modules' in sys.argv: - sys.argv.remove('--modules') + parser = optparse.OptionParser() + + parser.add_option("-c", "--config", dest="config", + help="specify config file") + parser.add_option("-m", "--modules", action="store_true", dest="modules", + default=False, help="Run also modules tests") + opt, args = parser.parse_args() + + if args: + parser.error("Invalid argument") + if opt.modules: _MODULES = True + if opt.config: + _CONFIGFILE = opt.config from trytond.config import CONFIG CONFIG['db_type'] = 'sqlite' -CONFIG.update_etc() +CONFIG.update_etc(_CONFIGFILE) if not CONFIG['admin_passwd']: CONFIG['admin_passwd'] = 'admin'