Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

py.test doesn't expose that an exception occurred while handling another #353

Closed
pytestbot opened this issue Sep 7, 2013 · 1 comment
Closed
Labels
type: bug problem that needs to be addressed

Comments

@pytestbot
Copy link
Contributor

Originally reported by: Dun Peal (BitBucket: dunpeal, GitHub: dunpeal)


#!python

$ cat foo.py 
def test_report():
    try:
        raise RuntimeError('foo')
    except RuntimeError:
        raise RuntimeError('bar')

if __name__ == '__main__': test_report()
$ python foo.py 
Traceback (most recent call last):
  File "foo.py", line 3, in test_report
    raise RuntimeError('foo')
RuntimeError: foo

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "foo.py", line 7, in <module>
    if __name__ == '__main__': test_report()
  File "foo.py", line 5, in test_report
    raise RuntimeError('bar')
RuntimeError: bar
$ py.test foo.py 
============================= test session starts ==============================
platform linux -- Python 3.3.1 -- pytest-2.3.5
plugins: xdist
collected 1 items 

foo.py F

=================================== FAILURES ===================================
_________________________________ test_report __________________________________

    def test_report():
        try:
            raise RuntimeError('foo')
        except RuntimeError:
>           raise RuntimeError('bar')
E           RuntimeError: bar

foo.py:5: RuntimeError
=========================== 1 failed in 0.01 seconds ===========================

@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


Duplicate of #138.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

1 participant