Skip to content

Competing ExceptionInfo classes. Losing stacktraces in terminal output #2433

@Magicjarvis

Description

@Magicjarvis

There are two ExceptionInfo classes and one of them seems to be eating exception stacktraces. any ideas?
one lives here venv/src/py/py/_code/code.py (I've added a print to its init and called it "ExceptionInfo #1"
and the other lives here /venv/lib/python3.5/site-packages/py/_code/code.py (ExceptionInfo #2)

Minimal example
Given this test file
test_repro.py

def really_do_the_assert():
    assert 1 == 0

def test_repro():
    really_do_the_assert()

class TestFoo(unittest.TestCase):
    def test_ugh(self):
        assert 1 == 0

I get this result from pytest test/test_repro.py

collected 2 items

test/test_repro.py ExceptionInfo #1 tup=None, exprinfo=None
FF
===Flaky Test Report===


===End Flaky Test Report===

============================================== FAILURES ==============================================
_____________________________________________ test_repro _____________________________________________
/Users/jarvis/webdev/py/example_repo/test/test_repro.py:5: AssertionError: assert 1 == 0
__________________________________________ TestFoo.test_ugh __________________________________________

self = <test.test_repro.TestFoo testMethod=test_ugh>

    def test_ugh(self):
>       assert 1 == 0
E       AssertionError: assert 1 == 0

test/test_repro.py:15: AssertionError
---------------------------------------- Captured stdout call ----------------------------------------
ExceptionInfo #2 tup=(<class 'AssertionError'>, AssertionError('assert 1 == 0',), <traceback object at 0x109ea8888>), exprinfo=None
====================================== 2 failed in 4.75 seconds ======================================
(venv) ➜  example_repo git:(test-repro) ✗

pytest version 3.0.7; mac os x

The ExceptionInfo used for test_repro() doesn't have an exception tuple associated, which is why i assume it can't print the stacktrace. Any ideas what's up?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions