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

Method test_stdout_callback_buffered

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

Source from the content-addressed store, hash-verified

1622 self.assertEqual(len(stdout), len("herpderp") * 5 + 5)
1623
1624 def test_stdout_callback_buffered(self):
1625 py = create_tmp_test(
1626 """
1627import sys
1628import os
1629
1630for i in range(5): sys.stdout.write("herpderp")
1631"""
1632 )
1633
1634 stdout = []
1635
1636 def agg(chunk):
1637 stdout.append(chunk)
1638
1639 p = python("-u", py.name, _out=agg, _out_bufsize=4)
1640 p.wait()
1641
1642 self.assertEqual(len(stdout), len("herp") / 2 * 5)
1643
1644 def test_stdout_callback_with_input(self):
1645 py = create_tmp_test(

Callers

nothing calls this directly

Calls 2

create_tmp_testFunction · 0.85
waitMethod · 0.45

Tested by

no test coverage detected