in teamcity/nose_report.py [0:0]
def configure(self, options, conf):
self.enabled = is_running_under_teamcity()
self.config = conf
if self._capture_plugin_enabled():
capture_plugin = self._get_capture_plugin()
old_before_test = capture_plugin.beforeTest
old_after_test = capture_plugin.afterTest
old_format_error = capture_plugin.formatError
def newCaptureBeforeTest(test):
rv = old_before_test(test)
test_id = self.get_test_id(test)
capture_plugin._buf = FlushingStringIO(lambda data: dump_test_stdout(self.messages, test_id, test_id, data))
sys.stdout = capture_plugin._buf
return rv
def newCaptureAfterTest(test):
if isinstance(capture_plugin._buf, FlushingStringIO):
capture_plugin._buf.flush()
return old_after_test(test)
def newCaptureFormatError(test, err):
if isinstance(capture_plugin._buf, FlushingStringIO):
capture_plugin._buf.flush()
return old_format_error(test, err)
capture_plugin.beforeTest = newCaptureBeforeTest
capture_plugin.afterTest = newCaptureAfterTest
capture_plugin.formatError = newCaptureFormatError