[stream-refactor] repaired rest of create_child_test.

pull/607/head
David Wilson 5 years ago
parent f039c81bb0
commit f43e24e970

@ -222,22 +222,20 @@ class TtyCreateChildTest(testlib.TestCase):
tf.close() tf.close()
if 0: class StderrDiagTtyMixin(object):
class StderrDiagTtyMixin(object):
def test_stderr(self): def test_stderr(self):
proc, info, buf = run_fd_check(self.func, 2, 'write', proc, info, buf = run_fd_check(self.func, 2, 'write',
lambda proc: wait_read(proc.diag_receive_side, 4)) lambda proc: wait_read(proc.stderr, 4))
st = os.fstat(proc.diag_receive_side.fd) st = os.fstat(proc.stderr.fileno())
self.assertTrue(stat.S_ISCHR(st.st_mode)) self.assertTrue(stat.S_ISCHR(st.st_mode))
self.assertTrue(stat.S_ISCHR(info['st_mode'])) self.assertTrue(stat.S_ISCHR(info['st_mode']))
self.assertTrue(isinstance(info['ttyname'], self.assertTrue(isinstance(info['ttyname'],
mitogen.core.UnicodeType)) mitogen.core.UnicodeType))
os.ttyname(proc.diag_transmit_side.fd) # crashes if wrong os.ttyname(proc.stderr.fileno()) # crashes if wrong
flags = fcntl.fcntl(proc.diag_receive_side.fd, fcntl.F_GETFL) flags = fcntl.fcntl(proc.stderr.fileno(), fcntl.F_GETFL)
self.assertTrue(flags & os.O_RDWR) self.assertTrue(flags & os.O_RDWR)
self.assertTrue(info['flags'] & os.O_RDWR) self.assertTrue(info['flags'] & os.O_RDWR)
@ -246,11 +244,14 @@ if 0:
self.assertTrue(buf, 'TEST') self.assertTrue(buf, 'TEST')
class HybridTtyCreateChildTest(StdinSockMixin, StdoutSockMixin, class HybridTtyCreateChildTest(StdinSockMixin, StdoutSockMixin,
StderrDiagTtyMixin, testlib.TestCase): StderrDiagTtyMixin, testlib.TestCase):
func = staticmethod(mitogen.parent.hybrid_tty_create_child) func = staticmethod(mitogen.parent.hybrid_tty_create_child)
if 0:
# issue #410
class SelinuxHybridTtyCreateChildTest(StderrDiagTtyMixin, testlib.TestCase): class SelinuxHybridTtyCreateChildTest(StderrDiagTtyMixin, testlib.TestCase):
func = staticmethod(mitogen.parent.selinux_hybrid_tty_create_child) func = staticmethod(mitogen.parent.selinux_hybrid_tty_create_child)

Loading…
Cancel
Save