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

Method test_stdout_callback_with_input

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

Source from the content-addressed store, hash-verified

1642 self.assertEqual(len(stdout), len("herp") / 2 * 5)
1643
1644 def test_stdout_callback_with_input(self):
1645 py = create_tmp_test(
1646 """
1647import sys
1648import os
1649
1650for i in range(5): print(str(i))
1651derp = input("herp? ")
1652print(derp)
1653"""
1654 )
1655
1656 def agg(line, stdin):
1657 if line.strip() == "4":
1658 stdin.put("derp\n")
1659
1660 p = python("-u", py.name, _out=agg, _tee=True)
1661 p.wait()
1662
1663 self.assertIn("derp", p)
1664
1665 def test_stdout_callback_exit(self):
1666 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