[REF] logging: removed pseudo log-level TEST.
When --test-enable is used, it is expected that test output is visible, thus using log-level INFO is natural. On the down side you lose the nice blue hint that tests did actually run when --log-level test was given. bzr revid: vmt@openerp.com-20130326155844-83e2tcqokvblr0ln
This commit is contained in:
parent
d96ec9c680
commit
c313b4073a
|
@ -411,7 +411,7 @@ class ir_mail_server(osv.osv):
|
|||
|
||||
# Do not actually send emails in testing mode!
|
||||
if getattr(threading.currentThread(), 'testing', False):
|
||||
_logger.log(logging.TEST, "skip sending email in test mode")
|
||||
_logger.info("skip sending email in test mode")
|
||||
return message['Message-Id']
|
||||
|
||||
# Get SMTP Server Details from Mail Server
|
||||
|
|
|
@ -20,19 +20,14 @@
|
|||
##############################################################################
|
||||
|
||||
import sys
|
||||
import logging
|
||||
|
||||
LOG_NOTSET = 'notset'
|
||||
LOG_DEBUG = 'debug'
|
||||
LOG_TEST = 'test'
|
||||
LOG_INFO = 'info'
|
||||
LOG_WARNING = 'warn'
|
||||
LOG_ERROR = 'error'
|
||||
LOG_CRITICAL = 'critical'
|
||||
|
||||
logging.TEST = logging.INFO - 5
|
||||
logging.addLevelName(logging.TEST, 'TEST')
|
||||
|
||||
# TODO get_encodings, ustr and exception_to_unicode were originally from tools.misc.
|
||||
# There are here until we refactor tools so that this module doesn't depends on tools.
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules=
|
|||
"""
|
||||
for filename in package.data[kind]:
|
||||
if kind == 'test':
|
||||
_logger.log(logging.TEST, "module %s: loading %s", module_name, filename)
|
||||
_logger.info("module %s: loading test %s", module_name, filename)
|
||||
else:
|
||||
_logger.info("module %s: loading %s", module_name, filename)
|
||||
_, ext = os.path.splitext(filename)
|
||||
|
|
|
@ -503,7 +503,7 @@ def run_unit_tests(module_name):
|
|||
for m in ms:
|
||||
suite.addTests(unittest2.TestLoader().loadTestsFromModule(m))
|
||||
if ms:
|
||||
_logger.log(logging.TEST, 'module %s: executing %s `fast_suite` and/or `checks` sub-modules', module_name, len(ms))
|
||||
_logger.info('module %s: executing %s `fast_suite` and/or `checks` sub-modules', module_name, len(ms))
|
||||
# Use a custom stream object to log the test executions.
|
||||
class MyStream(object):
|
||||
def __init__(self):
|
||||
|
@ -518,7 +518,7 @@ def run_unit_tests(module_name):
|
|||
if not first:
|
||||
c = '` ' + c
|
||||
first = False
|
||||
_logger.log(logging.TEST, c)
|
||||
_logger.info(c)
|
||||
result = unittest2.TextTestRunner(verbosity=2, stream=MyStream()).run(suite)
|
||||
if result.wasSuccessful():
|
||||
return True
|
||||
|
|
|
@ -63,7 +63,6 @@ COLOR_PATTERN = "%s%s%%s%s" % (COLOR_SEQ, COLOR_SEQ, RESET_SEQ)
|
|||
LEVEL_COLOR_MAPPING = {
|
||||
logging.DEBUG: (BLUE, DEFAULT),
|
||||
logging.INFO: (GREEN, DEFAULT),
|
||||
logging.TEST: (WHITE, BLUE),
|
||||
logging.WARNING: (YELLOW, DEFAULT),
|
||||
logging.ERROR: (RED, DEFAULT),
|
||||
logging.CRITICAL: (WHITE, RED),
|
||||
|
@ -161,7 +160,6 @@ PSEUDOCONFIG_MAPPER = {
|
|||
'debug_rpc': ['openerp:DEBUG','openerp.netsvc.rpc.request:DEBUG'],
|
||||
'debug': ['openerp:DEBUG'],
|
||||
'debug_sql': ['openerp.sql_db:DEBUG'],
|
||||
'test': ['openerp:TEST'],
|
||||
'info': [],
|
||||
'warn': ['openerp:WARNING'],
|
||||
'error': ['openerp:ERROR'],
|
||||
|
|
|
@ -84,7 +84,7 @@ class configmanager(object):
|
|||
self.config_file = fname
|
||||
self.has_ssl = check_ssl()
|
||||
|
||||
self._LOGLEVELS = dict([(getattr(loglevels, 'LOG_%s' % x), getattr(logging, x)) for x in ('CRITICAL', 'ERROR', 'WARNING', 'INFO', 'TEST', 'DEBUG', 'NOTSET')])
|
||||
self._LOGLEVELS = dict([(getattr(loglevels, 'LOG_%s' % x), getattr(logging, x)) for x in ('CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG', 'NOTSET')])
|
||||
|
||||
version = "%s %s" % (release.description, release.version)
|
||||
self.parser = parser = optparse.OptionParser(version=version, option_class=MyOption)
|
||||
|
|
|
@ -49,7 +49,7 @@ def try_report(cr, uid, rname, ids, data=None, context=None, our_module=None):
|
|||
rname_s = rname[7:]
|
||||
else:
|
||||
rname_s = rname
|
||||
_logger.log(netsvc.logging.TEST, " - Trying %s.create(%r)", rname, ids)
|
||||
_logger.info(" - Trying %s.create(%r)", rname, ids)
|
||||
res = netsvc.LocalService(rname).create(cr, uid, ids, data, context)
|
||||
if not isinstance(res, tuple):
|
||||
raise RuntimeError("Result of %s.create() should be a (data,format) tuple, now it is a %s" % \
|
||||
|
@ -92,7 +92,7 @@ def try_report(cr, uid, rname, ids, data=None, context=None, our_module=None):
|
|||
_logger.warning("Report %s produced a \"%s\" chunk, cannot examine it", rname, res_format)
|
||||
return False
|
||||
|
||||
_logger.log(netsvc.logging.TEST, " + Report %s produced correctly.", rname)
|
||||
_logger.info(" + Report %s produced correctly.", rname)
|
||||
return True
|
||||
|
||||
def try_report_action(cr, uid, action_id, active_model=None, active_ids=None,
|
||||
|
@ -126,7 +126,7 @@ def try_report_action(cr, uid, action_id, active_model=None, active_ids=None,
|
|||
pool = pooler.get_pool(cr.dbname)
|
||||
|
||||
def log_test(msg, *args):
|
||||
_logger.log(netsvc.logging.TEST, " - " + msg, *args)
|
||||
_logger.info(" - " + msg, *args)
|
||||
|
||||
datas = {}
|
||||
if active_model:
|
||||
|
|
|
@ -922,7 +922,7 @@ class YamlInterpreter(object):
|
|||
def yaml_import(cr, module, yamlfile, kind, idref=None, mode='init', noupdate=False, report=None):
|
||||
if idref is None:
|
||||
idref = {}
|
||||
loglevel = logging.TEST if kind == 'test' else logging.DEBUG
|
||||
loglevel = logging.INFO if kind == 'test' else logging.DEBUG
|
||||
yaml_string = yamlfile.read()
|
||||
yaml_interpreter = YamlInterpreter(cr, module, idref, mode, filename=yamlfile.name, report=report, noupdate=noupdate, loglevel=loglevel)
|
||||
yaml_interpreter.process(yaml_string)
|
||||
|
|
|
@ -47,7 +47,7 @@ def run(args):
|
|||
config = openerp.tools.config
|
||||
|
||||
if args.tests:
|
||||
config['log_handler'] = [':TEST']
|
||||
config['log_handler'] = [':INFO']
|
||||
config['test_enable'] = True
|
||||
config['without_demo'] = False
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue