nestorsalceda / mamba

The definitive testing tool for Python. Born under the banner of Behavior Driven Development (BDD).
http://nestorsalceda.github.io/mamba
MIT License
518 stars 65 forks source link

formatters._format_traceback loses spec assertion; removes too many frames? #93

Closed PhilHarnish closed 4 years ago

PhilHarnish commented 6 years ago

Sample failure:

  3) pooling it should reuse freed instances, if available
     Failure/Error: spec/data/pool_spec.py expect(PoolStub.allocated).to(equal(1))
         AssertionError: 
     expected: 12 to equal 1

     File "/path/to/python3.6/site-packages/expects/expectations.py", line 25, in _assert
         raise AssertionError(self._failure_message(matcher, reasons))
     File "/path/to/python3.6/site-packages/expects/expectations.py", line 19, in to
         self._assert(matcher)

Removing two lines fixes the issue:

    def _traceback(self, example_):
        tb = example_.error.traceback.tb_next
        #if tb.tb_next is not None:
        #    tb = tb.tb_next

        return tb

Giving the following:

  3) pooling it should reuse freed instances, if available
     Failure/Error: spec/data/pool_spec.py expect(PoolStub.allocated).to(equal(1))
         AssertionError: 
     expected: 12 to equal 1

     File "/path/to/python3.6/site-packages/expects/expectations.py", line 25, in _assert
         raise AssertionError(self._failure_message(matcher, reasons))
     File "/path/to/python3.6/site-packages/expects/expectations.py", line 19, in to
         self._assert(matcher)
     File "spec/data/pool_spec.py", line 53, in 00000027__it should reuse freed instances, if available--
         expect(PoolStub.allocated).to(equal(1))
nestorsalceda commented 6 years ago

Umm, not sure if this is related to Python 3.6 but yes, we are removing too many frames.

I will take a look.

Thanks!

nestorsalceda commented 4 years ago

I fixed prior to seeing this PR ! Grrr, sorry for this!