diff options
author | Thomas Kluyver <takowl@gmail.com> | 2013-10-21 12:37:21 -0700 |
---|---|---|
committer | Thomas Kluyver <takowl@gmail.com> | 2013-10-21 12:37:21 -0700 |
commit | dec517d98223cb1c6b04fa06a8da4f69827a8bbd (patch) | |
tree | 791e1916e16dace4948baad85d02e216bb6e9049 /tests/test_misc.py | |
parent | 84308e64d3ed10bc7f75d930269abb15e7b2bf8a (diff) | |
download | pexpect-git-dec517d98223cb1c6b04fa06a8da4f69827a8bbd.tar.gz |
Test and fix getting tracebacks excluding pexpect code
Diffstat (limited to 'tests/test_misc.py')
-rwxr-xr-x | tests/test_misc.py | 11 |
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() |