diff options
| -rw-r--r-- | tests/autopilot/autopilot/tests/__init__.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/autopilot/autopilot/tests/__init__.py b/tests/autopilot/autopilot/tests/__init__.py index d61a06ae7..12982ab90 100644 --- a/tests/autopilot/autopilot/tests/__init__.py +++ b/tests/autopilot/autopilot/tests/__init__.py @@ -4,6 +4,7 @@ Autopilot tests for Unity. from testtools import TestCase from testtools.content import text_content +import time import logging from StringIO import StringIO @@ -14,10 +15,24 @@ class AutopilotTestCase(TestCase): """Wrapper around testtools.TestCase that takes care of some cleaning.""" def setUp(self): + + class MyFormatter(logging.Formatter): + + def formatTime(self, record, datefmt=None): + ct = self.converter(record.created) + if datefmt: + s = time.strftime(datefmt, ct) + else: + t = time.strftime("%H:%M:%S", ct) + s = "%s.%03d" % (t, record.msecs) + return s + self._log_buffer = StringIO() root_logger = logging.getLogger() root_logger.setLevel(logging.DEBUG) handler = logging.StreamHandler(stream=self._log_buffer) + log_format = "%(asctime)s %(levelname)s %(pathname)s:%(lineno)d - %(message)s" + handler.setFormatter(MyFormatter(log_format)) root_logger.addHandler(handler) super(AutopilotTestCase, self).setUp() |
