Simplify AsynchronousDeferredRunTest._run_core's StringIO handling.

This commit is contained in:
Colin Watson
2015-04-03 12:13:58 +01:00
parent 93fd254f28
commit e73e7500b7

View File

@@ -13,15 +13,10 @@ __all__ = [
'SynchronousDeferredRunTest', 'SynchronousDeferredRunTest',
] ]
import os
import sys import sys
from testtools.compat import StringIO from testtools.compat import StringIO
from testtools.content import ( from testtools.content import text_content
Content,
text_content,
)
from testtools.content_type import UTF8_TEXT
from testtools.runtest import RunTest from testtools.runtest import RunTest
from testtools._spinner import ( from testtools._spinner import (
extract_result, extract_result,
@@ -233,10 +228,8 @@ class AsynchronousDeferredRunTest(_DeferredRunTest):
[error_observer.gotEvent, full_observer.emit], [error_observer.gotEvent, full_observer.emit],
self._blocking_run_deferred, spinner) self._blocking_run_deferred, spinner)
full_log.seek(0, os.SEEK_SET)
log_content = full_log.readlines()
self.case.addDetail( self.case.addDetail(
'twisted-log', Content(UTF8_TEXT, lambda: log_content)) 'twisted-log', text_content(full_log.getvalue()))
logged_errors = error_observer.flushErrors() logged_errors = error_observer.flushErrors()
for logged_error in logged_errors: for logged_error in logged_errors: