def test__logs_only_full_lines_from_stderr(self): message = factory.make_name("message") callback = Mock() proto = JSONPerLineProtocol(callback=callback) proto.connectionMade() with TwistedLoggerFixture() as logger: proto.errReceived(message.encode("ascii")) self.assertThat(logger.output, Equals(""))
def test__logs_stderr_at_process_end(self): message = factory.make_name("message") callback = Mock() proto = JSONPerLineProtocol(callback=callback) proto.connectionMade() with TwistedLoggerFixture() as logger: proto.errReceived(message.encode("ascii")) self.assertThat(logger.output, Equals("")) proto.processEnded(Failure(ProcessDone(0))) self.assertThat(logger.output, Equals(message))