summaryrefslogtreecommitdiff
path: root/tests/test_timeout_pattern.py
diff options
context:
space:
mode:
authorjquast <contact@jeffquast.com>2013-09-22 19:32:33 -0700
committerjquast <contact@jeffquast.com>2013-09-22 19:32:33 -0700
commitc851a110a61f20c2163aacdf6afe210d572d777b (patch)
tree6b07f4c3638b22fe5552efe333e0397fa4d9c8fd /tests/test_timeout_pattern.py
parenta83cf59505e18fd4ee0c84c4a1dd724e6f916e16 (diff)
downloadpexpect-git-c851a110a61f20c2163aacdf6afe210d572d777b.tar.gz
py2.5 compatibilities w/six.py
-except Exception as e: +except Exception, err: the unfortunate use of six.b('') instead of b'' print(arg0, arg1) => six.print_(arg0, arg1) some autopep8 -i is definitely called for, some of these test cases are darn unreadable, but did partially pep8 some of the really-long-over-80col-lines.
Diffstat (limited to 'tests/test_timeout_pattern.py')
-rwxr-xr-xtests/test_timeout_pattern.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/test_timeout_pattern.py b/tests/test_timeout_pattern.py
index dbeefcf..ef7ba72 100755
--- a/tests/test_timeout_pattern.py
+++ b/tests/test_timeout_pattern.py
@@ -43,7 +43,7 @@ class Exp_TimeoutTestCase(PexpectTestCase.PexpectTestCase):
p.sendline('Hello')
p.expect('Hello')
p.expect('Goodbye',timeout=5)
- except pexpect.TIMEOUT as expTimeoutInst:
+ except pexpect.TIMEOUT:
assert p.match_index == None
else:
self.fail("Did not generate a TIMEOUT exception.")
@@ -63,9 +63,10 @@ class Exp_TimeoutTestCase(PexpectTestCase.PexpectTestCase):
p = pexpect.spawn('cat')
p.sendline('Hello')
p.expect('Goodbye',timeout=5)
- except pexpect.TIMEOUT as e:
- if e.get_trace().count("pexpect.py") != 0:
- self.fail("The TIMEOUT get_trace() referenced pexpect.py. It should only reference the caller.\n"+e.get_trace())
+ except pexpect.TIMEOUT, err:
+ if err.get_trace().count("pexpect.py") != 0:
+ self.fail("The TIMEOUT get_trace() referenced pexpect.py. "
+ "It should only reference the caller.\n" + err.get_trace())
def test_correctStackTrace (self):
'''Verify that the stack trace returned with a TIMEOUT instance correctly handles function calls.'''
@@ -76,9 +77,11 @@ class Exp_TimeoutTestCase(PexpectTestCase.PexpectTestCase):
p = pexpect.spawn('cat')
p.sendline('Hello')
nestedFunction(p)
- except pexpect.TIMEOUT as e:
- if e.get_trace().count("nestedFunction") == 0:
- self.fail("The TIMEOUT get_trace() did not show the call to the nestedFunction function.\n" + str(e) + "\n" + e.get_trace())
+ except pexpect.TIMEOUT, err:
+ if err.get_trace().count("nestedFunction") == 0:
+ self.fail("The TIMEOUT get_trace() did not show the call "
+ "to the nestedFunction function.\n" + str(err) + "\n"
+ + err.get_trace())
if __name__ == '__main__':
unittest.main()