~sbaldassin/autopilot/fix_mir

« back to all changes in this revision

Viewing changes to autopilot/_logging.py

  • Committer: Tarmac
  • Author(s): Christopher Lee
  • Date: 2015-12-02 01:44:40 UTC
  • mfrom: (571.1.6 onlytext_addcontent)
  • Revision ID: tarmac-20151202014440-9u3ch1gijjj3y3se
Add functionality in autopilot that exists in recent testtools (not yet available on Ubuntu).

Approved by Selene Scriven, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
import logging
23
23
from io import StringIO
24
24
 
25
 
from testtools.content import text_content
26
 
 
27
25
from autopilot._fixtures import FixtureWithDirectAddDetail
28
 
from autopilot.utilities import LogFormatter
 
26
from autopilot.utilities import (
 
27
    LogFormatter,
 
28
    safe_text_content,
 
29
)
29
30
 
30
31
 
31
32
class TestCaseLoggingFixture(FixtureWithDirectAddDetail):
54
55
        self._log_buffer.seek(0)
55
56
        self.caseAddDetail(
56
57
            'test-log',
57
 
            text_content(self._log_buffer.getvalue())
 
58
            safe_text_content(self._log_buffer.getvalue())
58
59
        )
59
60
        root_logger.removeHandler(self._log_handler)
60
61
        self._log_buffer = None