Commit 3d229d5b authored by Philip ABBET's avatar Philip ABBET

[unittests] Change the logging system

parent a27907e9
......@@ -33,6 +33,7 @@ import sys
import shutil
import tempfile
import pkg_resources
import logging
prefix = pkg_resources.resource_filename(__name__, 'prefix')
......@@ -43,8 +44,25 @@ else:
tmp_prefix = tempfile.mkdtemp(prefix=__name__, suffix='.tmpdir')
def teardown_package():
# Setup the logging system
if False:
formatter = logging.Formatter(fmt="[%(asctime)s - TESTS - " \
"%(name)s] %(levelname)s: %(message)s",
datefmt="%d/%b/%Y %H:%M:%S")
handler = logging.StreamHandler()
handler.setFormatter(formatter)
beat_core_logger = logging.getLogger('beat.core')
beat_core_logger.addHandler(handler)
beat_backend_logger = logging.getLogger('beat.backend.python')
beat_backend_logger.addHandler(handler)
def teardown_package():
if os.path.exists(tmp_prefix):
shutil.rmtree(tmp_prefix)
......
......@@ -32,15 +32,6 @@ import os
import logging
logger = logging.getLogger(__name__)
# in case you want to see the printouts dynamically, set to ``True``
if False:
logger = logging.getLogger() #root logger
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
ch.setFormatter(logging.Formatter('%(levelname)s: %(message)s'))
logger.addHandler(ch)
import unittest
import zmq
......
......@@ -44,18 +44,6 @@ from . import tmp_prefix
from .utils import slow
# in case you want to see the printouts dynamically, set to ``True``
if False:
import logging
logger = logging.getLogger() #root logger
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
ch.setFormatter(logging.Formatter('%(levelname)s: %(message)s'))
logger.addHandler(ch)
class AsyncTest(unittest.TestCase):
@classmethod
......
......@@ -33,15 +33,6 @@ import glob
import logging
logger = logging.getLogger(__name__)
# in case you want to see the printouts dynamically, set to ``True``
if False:
logger = logging.getLogger() #root logger
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
ch.setFormatter(logging.Formatter('%(levelname)s: %(message)s'))
logger.addHandler(ch)
import numpy
import unittest
......
......@@ -32,15 +32,6 @@ import os
import logging
logger = logging.getLogger(__name__)
# in case you want to see the printouts dynamically, set to ``True``
if False:
logger = logging.getLogger() #root logger
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
ch.setFormatter(logging.Formatter('%(levelname)s: %(message)s'))
logger.addHandler(ch)
import unittest
import zmq
import nose.tools
......
File mode changed from 100755 to 100644
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment