Test fails on Python 3, instead of spinning until timeout.

This commit is contained in:
Itamar Turner-Trauring 2021-05-07 10:06:12 -04:00
parent 036a864dc9
commit 0d093c45df
3 changed files with 4 additions and 2 deletions

View File

@ -28,7 +28,7 @@ from twisted.internet.error import (
import pytest import pytest
import pytest_twisted import pytest_twisted
from util import ( from .util import (
_CollectOutputProtocol, _CollectOutputProtocol,
_MagicTextProtocol, _MagicTextProtocol,
_DumpOutputProtocol, _DumpOutputProtocol,

View File

@ -3,7 +3,7 @@ from os.path import join
from twisted.internet.error import ProcessTerminated from twisted.internet.error import ProcessTerminated
import util from . import util
import pytest_twisted import pytest_twisted

View File

@ -116,6 +116,7 @@ class _MagicTextProtocol(ProcessProtocol):
self.exited.callback(None) self.exited.callback(None)
def outReceived(self, data): def outReceived(self, data):
data = unicode(data, sys.stdout.encoding)
sys.stdout.write(data) sys.stdout.write(data)
self._output.write(data) self._output.write(data)
if not self.magic_seen.called and self._magic_text in self._output.getvalue(): if not self.magic_seen.called and self._magic_text in self._output.getvalue():
@ -123,6 +124,7 @@ class _MagicTextProtocol(ProcessProtocol):
self.magic_seen.callback(self) self.magic_seen.callback(self)
def errReceived(self, data): def errReceived(self, data):
data = unicode(data, sys.stderr.encoding)
sys.stdout.write(data) sys.stdout.write(data)