summaryrefslogtreecommitdiff
path: root/tests/test_misc.py
diff options
context:
space:
mode:
authorThomas Kluyver <takowl@gmail.com>2013-10-21 12:37:21 -0700
committerThomas Kluyver <takowl@gmail.com>2013-10-21 12:37:21 -0700
commitdec517d98223cb1c6b04fa06a8da4f69827a8bbd (patch)
tree791e1916e16dace4948baad85d02e216bb6e9049 /tests/test_misc.py
parent84308e64d3ed10bc7f75d930269abb15e7b2bf8a (diff)
downloadpexpect-git-dec517d98223cb1c6b04fa06a8da4f69827a8bbd.tar.gz
Test and fix getting tracebacks excluding pexpect code
Diffstat (limited to 'tests/test_misc.py')
-rwxr-xr-xtests/test_misc.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_misc.py b/tests/test_misc.py
index a802357..b6d5372 100755
--- a/tests/test_misc.py
+++ b/tests/test_misc.py
@@ -294,6 +294,17 @@ class TestCaseMisc(PexpectTestCase.PexpectTestCase):
p.expect('abc')
p.sendeof()
+ def test_exception_tb(self):
+ p = pexpect.spawn('sleep 1')
+ try:
+ p.expect('BLAH')
+ except pexpect.ExceptionPexpect as e:
+ # get_trace should filter out frames in pexpect's own code
+ tb = e.get_trace()
+ assert 'raise ' not in tb, tb
+ else:
+ assert False, "Should have raised an exception."
+
if __name__ == '__main__':
unittest.main()