MCPcopy Create free account
hub / github.com/pexpect/pexpect / test_expect_eof

Method test_expect_eof

tests/test_popen_spawn.py:87–95  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

85 self.assertEqual(p.after, b'.?')
86
87 def test_expect_eof(self):
88 the_old_way = subprocess.Popen(args=['ls', '-l', '/bin'],
89 stdout=subprocess.PIPE).communicate()[0].rstrip()
90 p = PopenSpawn('ls -l /bin')
91 # This basically tells it to read everything. Same as pexpect.run()
92 # function.
93 p.expect(pexpect.EOF)
94 the_new_way = p.before.rstrip()
95 assert the_old_way == the_new_way, len(the_old_way) - len(the_new_way)
96
97 def test_expect_timeout(self):
98 p = PopenSpawn('cat', timeout=5)

Callers

nothing calls this directly

Calls 2

PopenSpawnClass · 0.90
expectMethod · 0.80

Tested by

no test coverage detected