Enable logging in tests (fixes #21)
* add logging.config.fileConfig in gnuviechadmin/tests/__init__.py * provide default logging configuration in test.ini git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/trunk@259 a67ec6bc-e5d5-0310-a910-815c51eb3124
This commit is contained in:
parent
065996e0df
commit
b183465d5e
2 changed files with 31 additions and 0 deletions
|
@ -29,6 +29,7 @@ setuptools.
|
|||
"""
|
||||
import os
|
||||
import sys
|
||||
import logging.config
|
||||
from unittest import TestCase
|
||||
|
||||
import pkg_resources
|
||||
|
@ -40,3 +41,4 @@ sys.path.insert(0, conf_dir)
|
|||
pkg_resources.working_set.add_entry(conf_dir)
|
||||
|
||||
test_file = os.path.join(conf_dir, 'test.ini')
|
||||
logging.config.fileConfig(test_file)
|
||||
|
|
29
test.ini
Normal file
29
test.ini
Normal file
|
@ -0,0 +1,29 @@
|
|||
# Logging configuration
|
||||
[loggers]
|
||||
keys = root, gnuviechadmin
|
||||
|
||||
[handlers]
|
||||
keys = console
|
||||
|
||||
[formatters]
|
||||
keys = generic
|
||||
|
||||
[logger_root]
|
||||
level = INFO
|
||||
handlers = console
|
||||
|
||||
[logger_gnuviechadmin]
|
||||
level = DEBUG
|
||||
handlers = console
|
||||
propagate = 0
|
||||
qualname = gnuviechadmin
|
||||
|
||||
[handler_console]
|
||||
class = StreamHandler
|
||||
args = (sys.stderr,)
|
||||
level = NOTSET
|
||||
formatter = generic
|
||||
|
||||
[formatter_generic]
|
||||
format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
|
||||
datefmt = %H:%M:%S
|
Loading…
Reference in a new issue