diff options
author | jquast <contact@jeffquast.com> | 2013-09-22 21:46:20 -0700 |
---|---|---|
committer | jquast <contact@jeffquast.com> | 2013-09-22 21:46:20 -0700 |
commit | 7aa7e199d6035903e3f85de145bef30d221ab3f6 (patch) | |
tree | 996d5dad1be45fa9b9f6540713255fe4bfc92b01 /tests/test_timeout_pattern.py | |
parent | a1b4c5ff2dc8fc70bf975d0313d8743f3097f34c (diff) | |
download | pexpect-git-7aa7e199d6035903e3f85de145bef30d221ab3f6.tar.gz |
exception fixes for py2.5<->3.2 compat
Diffstat (limited to 'tests/test_timeout_pattern.py')
-rwxr-xr-x | tests/test_timeout_pattern.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/test_timeout_pattern.py b/tests/test_timeout_pattern.py index ef7ba72..a8a6835 100755 --- a/tests/test_timeout_pattern.py +++ b/tests/test_timeout_pattern.py @@ -22,6 +22,7 @@ from __future__ import with_statement # bring 'with' stmt to py25 import pexpect import unittest import PexpectTestCase +import sys class Exp_TimeoutTestCase(PexpectTestCase.PexpectTestCase): def test_matches_exp_timeout (self): @@ -63,7 +64,8 @@ class Exp_TimeoutTestCase(PexpectTestCase.PexpectTestCase): p = pexpect.spawn('cat') p.sendline('Hello') p.expect('Goodbye',timeout=5) - except pexpect.TIMEOUT, err: + except pexpect.TIMEOUT: + err = sys.exc_info()[1] 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()) @@ -77,7 +79,8 @@ class Exp_TimeoutTestCase(PexpectTestCase.PexpectTestCase): p = pexpect.spawn('cat') p.sendline('Hello') nestedFunction(p) - except pexpect.TIMEOUT, err: + except pexpect.TIMEOUT: + err = sys.exc_info()[1] 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" |