[stream-refactor] Py3.x test fixes

pull/607/head
David Wilson 5 years ago
parent 14f8f00d4d
commit 6da991fae9

@ -9,9 +9,9 @@ import time
# #363: old input loop would fail to spot auth failure because of scheduling
# vs. su calling write() twice.
if 'DO_SLOW_AUTH_FAILURE' in os.environ:
os.write(2, 'su: ')
os.write(2, u'su: '.encode())
time.sleep(0.5)
os.write(2, 'incorrect password\n')
os.write(2, u'incorrect password\n'.encode())
os._exit(1)

@ -41,7 +41,7 @@ class CommandLineTest(testlib.RouterMixin, testlib.TestCase):
stdout, stderr = proc.communicate()
self.assertEquals(0, proc.returncode)
self.assertEquals(stdout,
mitogen.parent.BootstrapProtocol.EC0_MARKER+'\n')
mitogen.parent.BootstrapProtocol.EC0_MARKER+b('\n'))
self.assertIn(b("Error -5 while decompressing data"), stderr)
finally:
fp.close()

@ -14,6 +14,11 @@ from testlib import Popen__terminate
import mitogen.parent
try:
file
except NameError:
from io import FileIO as file
def wait_for_child(pid, timeout=1.0):
deadline = time.time() + timeout
@ -226,7 +231,8 @@ class TtyCreateChildTest(testlib.TestCase):
])
deadline = time.time() + 5.0
mitogen.core.set_block(proc.stdin.fileno())
self.assertEquals(mitogen.core.b('hi\n'), proc.stdin.read())
# read(3) below due to https://bugs.python.org/issue37696
self.assertEquals(mitogen.core.b('hi\n'), proc.stdin.read(3))
waited_pid, status = os.waitpid(proc.pid, 0)
self.assertEquals(proc.pid, waited_pid)
self.assertEquals(0, status)

Loading…
Cancel
Save