From 079b425d1108bae2e5b583ed6f3b9bcfc299141e Mon Sep 17 00:00:00 2001 From: Vo Minh Thu Date: Wed, 22 Aug 2012 15:48:20 +0200 Subject: [PATCH] [FIX] tests: allow running the tests when installing a database created by XML-RPC. bzr revid: vmt@openerp.com-20120822134820-pevo06jwrhm8unui --- openerp/tests/common.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openerp/tests/common.py b/openerp/tests/common.py index b1af4338312..53c67c68844 100644 --- a/openerp/tests/common.py +++ b/openerp/tests/common.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- import os +import threading import time import unittest2 import xmlrpclib @@ -11,6 +12,13 @@ ADDONS_PATH = openerp.tools.config['addons_path'] PORT = openerp.tools.config['xmlrpc_port'] DB = openerp.tools.config['db_name'] +# If the database name is not provided on the command-line, +# use the one on the thread (which means if it is provided on +# the command-line, this will break when installing another +# database from XML-RPC). +if not DB and hasattr(threading.current_thread(), 'dbname'): + DB = threading.current_thread().dbname + HOST = '127.0.0.1' ADMIN_USER = 'admin'