diff options
author | jquast <contact@jeffquast.com> | 2014-03-16 19:21:23 -0700 |
---|---|---|
committer | jquast <contact@jeffquast.com> | 2014-03-16 19:21:23 -0700 |
commit | c96d428aa85e7d547c4f7d56f9bca13a1443e772 (patch) | |
tree | f315b084af1403813903eaf9a83e7138a9d41157 | |
parent | fcf4ad9b744f845b9c88f63c735ff686f24381e2 (diff) | |
download | pexpect-c96d428aa85e7d547c4f7d56f9bca13a1443e772.tar.gz |
export TERM=dumb for /bin/ls tests
OSX (freebsd) profile environment values tend to
enable color by default, causing a difference in
output (one containing terminal capabilities,
the other not). Force TERM=dumb to ensure no
color capabilities are used.
-rwxr-xr-x | tests/test_expect.py | 15 | ||||
-rwxr-xr-x | tests/test_run.py | 6 |
2 files changed, 13 insertions, 8 deletions
diff --git a/tests/test_expect.py b/tests/test_expect.py index d5d0c9c..14fddb3 100755 --- a/tests/test_expect.py +++ b/tests/test_expect.py @@ -305,8 +305,9 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase): def test_expect (self): the_old_way = subprocess.Popen(args=['ls', '-l', '/bin'], - stdout=subprocess.PIPE).communicate()[0].rstrip() - p = pexpect.spawn('ls -l /bin') + stdout=subprocess.PIPE, env={'TERM': 'dumb'} + ).communicate()[0].rstrip() + p = pexpect.spawn('ls -l /bin', env={'TERM': 'dumb'}) the_new_way = b'' while 1: i = p.expect ([b'\n', pexpect.EOF]) @@ -322,8 +323,9 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase): def test_expect_exact (self): the_old_way = subprocess.Popen(args=['ls', '-l', '/bin'], - stdout=subprocess.PIPE).communicate()[0].rstrip() - p = pexpect.spawn('ls -l /bin') + stdout=subprocess.PIPE, env={'TERM': 'dumb'} + ).communicate()[0].rstrip() + p = pexpect.spawn('ls -l /bin', env={'TERM': 'dumb'}) the_new_way = b'' while 1: i = p.expect_exact ([b'\n', pexpect.EOF]) @@ -342,8 +344,9 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase): def test_expect_eof (self): the_old_way = subprocess.Popen(args=['/bin/ls', '-l', '/bin'], - stdout=subprocess.PIPE).communicate()[0].rstrip() - p = pexpect.spawn('/bin/ls -l /bin') + stdout=subprocess.PIPE, env={'TERM': 'dumb'} + ).communicate()[0].rstrip() + p = pexpect.spawn('ls -l /bin', env={'TERM': 'dumb'}) p.expect(pexpect.EOF) # This basically tells it to read everything. Same as pexpect.run() function. the_new_way = p.before the_new_way = the_new_way.replace(b'\r\n', b'\n' diff --git a/tests/test_run.py b/tests/test_run.py index 6346ced..cfdb44f 100755 --- a/tests/test_run.py +++ b/tests/test_run.py @@ -50,8 +50,10 @@ class RunFuncTestCase(PexpectTestCase.PexpectTestCase): def test_run (self): the_old_way = subprocess.Popen(args=['ls', '-l', '/bin'], - stdout=subprocess.PIPE).communicate()[0].rstrip() - (the_new_way, exitstatus) = self.runfunc('ls -l /bin', withexitstatus=1) + stdout=subprocess.PIPE, env={'TERM': 'dumb'} + ).communicate()[0].rstrip() + (the_new_way, exitstatus) = self.runfunc('ls -l /bin', + withexitstatus=1, env={'TERM': 'dumb'}) the_new_way = the_new_way.replace(self.cr, self.empty).rstrip() self.assertEqual(self.prep_subprocess_out(the_old_way), the_new_way) self.assertEqual(exitstatus, 0) |