[stream-refactor] repaired rest of create_child_test.

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

@ -222,35 +222,36 @@ class TtyCreateChildTest(testlib.TestCase):
tf.close() tf.close()
if 0: class StderrDiagTtyMixin(object):
def test_stderr(self):
proc, info, buf = run_fd_check(self.func, 2, 'write',
lambda proc: wait_read(proc.stderr, 4))
class StderrDiagTtyMixin(object): st = os.fstat(proc.stderr.fileno())
def test_stderr(self): self.assertTrue(stat.S_ISCHR(st.st_mode))
proc, info, buf = run_fd_check(self.func, 2, 'write', self.assertTrue(stat.S_ISCHR(info['st_mode']))
lambda proc: wait_read(proc.diag_receive_side, 4))
st = os.fstat(proc.diag_receive_side.fd) self.assertTrue(isinstance(info['ttyname'],
self.assertTrue(stat.S_ISCHR(st.st_mode)) mitogen.core.UnicodeType))
self.assertTrue(stat.S_ISCHR(info['st_mode'])) os.ttyname(proc.stderr.fileno()) # crashes if wrong
self.assertTrue(isinstance(info['ttyname'], flags = fcntl.fcntl(proc.stderr.fileno(), fcntl.F_GETFL)
mitogen.core.UnicodeType)) self.assertTrue(flags & os.O_RDWR)
os.ttyname(proc.diag_transmit_side.fd) # crashes if wrong self.assertTrue(info['flags'] & os.O_RDWR)
flags = fcntl.fcntl(proc.diag_receive_side.fd, fcntl.F_GETFL) self.assertNotEquals(st.st_dev, info['st_dev'])
self.assertTrue(flags & os.O_RDWR) self.assertTrue(flags & os.O_RDWR)
self.assertTrue(info['flags'] & os.O_RDWR) self.assertTrue(buf, 'TEST')
self.assertNotEquals(st.st_dev, info['st_dev'])
self.assertTrue(flags & os.O_RDWR)
self.assertTrue(buf, 'TEST')
class HybridTtyCreateChildTest(StdinSockMixin, StdoutSockMixin,
StderrDiagTtyMixin, testlib.TestCase):
func = staticmethod(mitogen.parent.hybrid_tty_create_child)
class HybridTtyCreateChildTest(StdinSockMixin, StdoutSockMixin,
StderrDiagTtyMixin, testlib.TestCase):
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