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

[unittests] Change the logging system

parent a27907e9
...@@ -33,6 +33,7 @@ import sys ...@@ -33,6 +33,7 @@ import sys
import shutil import shutil
import tempfile import tempfile
import pkg_resources import pkg_resources
import logging
prefix = pkg_resources.resource_filename(__name__, 'prefix') prefix = pkg_resources.resource_filename(__name__, 'prefix')
...@@ -43,8 +44,25 @@ else: ...@@ -43,8 +44,25 @@ else:
tmp_prefix = tempfile.mkdtemp(prefix=__name__, suffix='.tmpdir') 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): if os.path.exists(tmp_prefix):
shutil.rmtree(tmp_prefix) shutil.rmtree(tmp_prefix)
......
...@@ -32,15 +32,6 @@ import os ...@@ -32,15 +32,6 @@ import os
import logging import logging
logger = logging.getLogger(__name__) 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 unittest
import zmq import zmq
......
...@@ -44,18 +44,6 @@ from . import tmp_prefix ...@@ -44,18 +44,6 @@ from . import tmp_prefix
from .utils import slow 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): class AsyncTest(unittest.TestCase):
@classmethod @classmethod
......
...@@ -33,15 +33,6 @@ import glob ...@@ -33,15 +33,6 @@ import glob
import logging import logging
logger = logging.getLogger(__name__) 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 numpy
import unittest import unittest
......
...@@ -32,15 +32,6 @@ import os ...@@ -32,15 +32,6 @@ import os
import logging import logging
logger = logging.getLogger(__name__) 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 unittest
import zmq import zmq
import nose.tools 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