[IMP] indicate tests in current thread, and prevent email sending during tests
bzr revid: rco@openerp.com-20111201153156-2ki7x22evf5ojyrz
This commit is contained in:
parent
43745c4cb9
commit
9aa1ecbe58
|
@ -381,6 +381,10 @@ class ir_mail_server(osv.osv):
|
|||
smtp_to_list = filter(None, tools.flatten(map(extract_rfc2822_addresses,[email_to, email_cc, email_bcc])))
|
||||
assert smtp_to_list, "At least one valid recipient address should be specified for outgoing emails (To/Cc/Bcc)"
|
||||
|
||||
# Do not actually send emails in testing mode!
|
||||
if getattr(threading.currentThread(), 'testing', False):
|
||||
return message['Message-Id']
|
||||
|
||||
# Get SMTP Server Details from Mail Server
|
||||
mail_server = None
|
||||
if mail_server_id:
|
||||
|
|
|
@ -31,6 +31,7 @@ import logging
|
|||
import os
|
||||
import re
|
||||
import sys
|
||||
import threading
|
||||
import zipfile
|
||||
import zipimport
|
||||
|
||||
|
@ -97,11 +98,13 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules=
|
|||
cr.commit()
|
||||
if not tools.config.options['test_disable']:
|
||||
try:
|
||||
threading.currentThread().testing = True
|
||||
_load_data(cr, module_name, idref, mode, 'test')
|
||||
except Exception, e:
|
||||
logging.getLogger('init.test').exception(
|
||||
'Tests failed to execute in module %s', module_name)
|
||||
finally:
|
||||
threading.currentThread().testing = False
|
||||
if tools.config.options['test_commit']:
|
||||
cr.commit()
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue