Activity log for bug #1188420

Date Who What changed Old value New value Message
2013-06-07 00:04:48 Leo Arias bug added bug
2013-06-07 00:04:59 Leo Arias testtools: status New Confirmed
2013-06-07 00:07:06 Leo Arias description When an AssertionError is thrown during the fixture set up, then _count_relevant_tb_levels will return 1. Then, the traceback of the error will not be reported. To reproduce: Here I have two tests with wrong fixtures. One raises a ZeroDivisionError and the other one an AssertionError import fixtures import testtools class WrongFixtureWithoutTrace(fixtures.Fixture): def setUp(self): super(WrongFixtureWithoutTrace, self).setUp() raise AssertionError('error') class WrongFixtureWithTrace(fixtures.Fixture): def setUp(self): super(WrongFixtureWithTrace, self).setUp() 1/0 class TestCase(testtools.TestCase): def test_without_trace(self): self.useFixture(WrongFixtureWithoutTrace()) def test_with_trace(self): self.useFixture(WrongFixtureWithTrace()) When I run them, I get: ====================================================================== ERROR: test_with_trace (test.TestCase) ---------------------------------------------------------------------- _StringException: Traceback (most recent call last): File "/tmp/test.py", line 22, in test_with_trace self.useFixture(WrongFixtureWithTrace()) File "/usr/lib/python2.7/dist-packages/testtools/testcase.py", line 579, in useFixture fixture.setUp() File "/tmp/test.py", line 13, in setUp 1/0 ZeroDivisionError: integer division or modulo by zero ====================================================================== FAIL: test_without_trace (test.TestCase) ---------------------------------------------------------------------- _StringException: Traceback (most recent call last): File "/tmp/test.py", line 19, in test_without_trace self.useFixture(WrongFixtureWithoutTrace()) AssertionError: error ---------------------------------------------------------------------- Ran 2 tests in 5.854s FAILED (failures=1, errors=1) Not on the second test that there is only one line of the trace, hiding where and why the error occured. When an AssertionError is thrown during the fixture set up, then _count_relevant_tb_levels will return 1. Then, the traceback of the error will not be reported. To reproduce: Here I have two tests with wrong fixtures. One raises a ZeroDivisionError and the other one an AssertionError import fixtures import testtools class WrongFixtureWithoutTrace(fixtures.Fixture):    def setUp(self):       super(WrongFixtureWithoutTrace, self).setUp()       raise AssertionError('error') class WrongFixtureWithTrace(fixtures.Fixture):    def setUp(self):       super(WrongFixtureWithTrace, self).setUp()       1/0 class TestCase(testtools.TestCase):     def test_without_trace(self):         self.useFixture(WrongFixtureWithoutTrace())     def test_with_trace(self):         self.useFixture(WrongFixtureWithTrace()) When I run them, I get: ====================================================================== ERROR: test_with_trace (test.TestCase) ---------------------------------------------------------------------- _StringException: Traceback (most recent call last):   File "/tmp/test.py", line 22, in test_with_trace     self.useFixture(WrongFixtureWithTrace())   File "/usr/lib/python2.7/dist-packages/testtools/testcase.py", line 579, in useFixture     fixture.setUp()   File "/tmp/test.py", line 13, in setUp     1/0 ZeroDivisionError: integer division or modulo by zero ====================================================================== FAIL: test_without_trace (test.TestCase) ---------------------------------------------------------------------- _StringException: Traceback (most recent call last):   File "/tmp/test.py", line 19, in test_without_trace     self.useFixture(WrongFixtureWithoutTrace()) AssertionError: error ---------------------------------------------------------------------- Ran 2 tests in 5.854s FAILED (failures=1, errors=1) Note on the second test that there is only one line of the trace, hiding where and why the error occured.
2013-06-07 00:07:11 Robert Collins testtools: status Confirmed Triaged
2013-06-07 00:07:12 Robert Collins testtools: importance Undecided High
2013-06-16 07:23:23 Robert Collins summary useFixture hides the trace when the fixture throws an AssertionError on setUp traceback filtering of non-contiguous unittest frames is broken
2013-06-16 07:23:34 Robert Collins testtools: assignee Robert Collins (lifeless)
2013-06-16 07:23:36 Robert Collins testtools: milestone next
2013-06-17 20:53:00 Jonathan Lange testtools: milestone 0.9.32
2013-12-03 14:09:38 Vincent Ladeuil bug added subscriber Vincent Ladeuil
2023-09-28 12:55:33 Adam Collard bug added subscriber Adam Collard