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

Method test_stdout_callback_line_unbuffered

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

Source from the content-addressed store, hash-verified

1601 self.assertEqual(len(stdout), 5)
1602
1603 def test_stdout_callback_line_unbuffered(self):
1604 py = create_tmp_test(
1605 """
1606import sys
1607import os
1608
1609for i in range(5): print("herpderp")
1610"""
1611 )
1612
1613 stdout = []
1614
1615 def agg(char):
1616 stdout.append(char)
1617
1618 p = python("-u", py.name, _out=agg, _out_bufsize=0)
1619 p.wait()
1620
1621 # + 5 newlines
1622 self.assertEqual(len(stdout), len("herpderp") * 5 + 5)
1623
1624 def test_stdout_callback_buffered(self):
1625 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