diff options
author | Steven Silvester <steven.silvester@ieee.org> | 2014-12-01 21:27:33 -0600 |
---|---|---|
committer | Thomas Kluyver <takowl@gmail.com> | 2015-09-12 11:49:09 +0100 |
commit | cd9296c1b93bcdd1006cd044110c3e806c322a66 (patch) | |
tree | 31d31deae221bcdcd44dde250f21e885ced32050 /tests | |
parent | 6407d849d4719c9aeda1eca011808044fb126764 (diff) | |
download | pexpect-git-cd9296c1b93bcdd1006cd044110c3e806c322a66.tar.gz |
Fix popen spawn and tests on windows
Cleanup
Always close stdin
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_popen_spawn.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/test_popen_spawn.py b/tests/test_popen_spawn.py index 3431e49..740b510 100644 --- a/tests/test_popen_spawn.py +++ b/tests/test_popen_spawn.py @@ -52,9 +52,9 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase): p.expect_exact(pexpect.EOF) def test_expect(self): - the_old_way = subprocess.Popen(args=['ls', '-l', '/bin'], + the_old_way = subprocess.Popen(args=['ls', '-l', '~'], stdout=subprocess.PIPE).communicate()[0].rstrip() - p = PopenSpawn('ls -l /bin') + p = PopenSpawn('ls -l ~') the_new_way = b'' while 1: i = p.expect([b'\n', pexpect.EOF]) @@ -66,9 +66,9 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase): assert the_old_way == the_new_way, len(the_old_way) - len(the_new_way) def test_expect_exact(self): - the_old_way = subprocess.Popen(args=['ls', '-l', '/bin'], + the_old_way = subprocess.Popen(args=['ls', '-l', '~'], stdout=subprocess.PIPE).communicate()[0].rstrip() - p = PopenSpawn('ls -l /bin') + p = PopenSpawn('ls -l ~') the_new_way = b'' while 1: i = p.expect_exact([b'\n', pexpect.EOF]) @@ -85,9 +85,9 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase): self.assertEqual(p.after, b'.?') def test_expect_eof(self): - the_old_way = subprocess.Popen(args=['/bin/ls', '-l', '/bin'], + the_old_way = subprocess.Popen(args=['ls', '-l', '~'], stdout=subprocess.PIPE).communicate()[0].rstrip() - p = PopenSpawn('/bin/ls -l /bin') + p = PopenSpawn('ls -l ~') # This basically tells it to read everything. Same as pexpect.run() # function. p.expect(pexpect.EOF) @@ -100,7 +100,7 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase): self.assertEqual(p.after, pexpect.TIMEOUT) def test_unexpected_eof(self): - p = PopenSpawn('ls -l /bin') + p = PopenSpawn('ls -l ~') try: p.expect('_Z_XY_XZ') # Probably never see this in ls output. except pexpect.EOF: |