MCPcopy
hub / github.com/amoffat/sh / test_tty_tee

Method test_tty_tee

tests/sh_test.py:1360–1383  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1358 self.assertEqual(p.stderr, b"stderr")
1359
1360 def test_tty_tee(self):
1361 py = create_tmp_test(
1362 """
1363import sys
1364sys.stdout.write("stdout")
1365"""
1366 )
1367 read, write = pty.openpty()
1368 out = python("-u", py.name, _out=write).stdout
1369 tee = os.read(read, 6)
1370
1371 self.assertEqual(out, b"")
1372 self.assertEqual(tee, b"stdout")
1373 os.close(write)
1374 os.close(read)
1375
1376 read, write = pty.openpty()
1377 out = python("-u", py.name, _out=write, _tee=True).stdout
1378 tee = os.read(read, 6)
1379
1380 self.assertEqual(out, b"stdout")
1381 self.assertEqual(tee, b"stdout")
1382 os.close(write)
1383 os.close(read)
1384
1385 def test_err_redirection_actual_file(self):
1386 import tempfile

Callers

nothing calls this directly

Calls 3

create_tmp_testFunction · 0.85
readMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected