← Back to team overview

testtools-dev team mailing list archive

[Bug 788974] Re: exception stack depth not restricted to relevant modules

 

Bug 660852 isn't a dupe, but it's close. I think we can hide those
frames without causing too many problems for testtools own development.

-- 
You received this bug notification because you are a member of testtools
developers, which is subscribed to testtools.
https://bugs.launchpad.net/bugs/788974

Title:
  exception stack depth not restricted to relevant modules

Status in testtools:
  Triaged

Bug description:
  Hi!

  I'm just playing around with testtools trying to understand what I
  need to do to use them.

  One thing I noticed is that when a test fails, I get the complete
  interpreter stack in the exception:

  Traceback (most recent call last):
    File "/usr/lib/python2.7/dist-packages/testtools/runtest.py", line 169, in _run_user
      return fn(*args, **kwargs)
    File "/usr/lib/python2.7/dist-packages/testtools/testcase.py", line 499, in _run_test_method
      return self._get_test_method()()
    File "./test-tt.py", line 17, in test_foo
      self.assertEqual(1,0)
    File "/usr/lib/python2.7/dist-packages/testtools/testcase.py", line 268, in assertEqual
      self.assertThat(observed, matcher)
    File "/usr/lib/python2.7/dist-packages/testtools/testcase.py", line 345, in assertThat
      % (matchee, matcher, mismatch.describe()))
  AssertionError: Match failed. Matchee: "0"
  Matcher: Equals(1)
  Difference: 1 != 0

  But most of that information is irrelevant, and I don't want to be
  trawling through it trying to work out what's going on.

  In "unittest", it gets truncated to just the relevant parts:

  Traceback (most recent call last):
    File "./test.py", line 15, in test_foo
      self.assertEqual(1,0)
  AssertionError: 1 != 0

  It looks like unittest has some code to strip out the junk, in the
  shape of functions _is_relevant_tb_levels() and
  _count_relevant_tb_levels().

  I started looking to see where this could be fixed but couldn't see
  quite the cleanest way.

To manage notifications about this bug go to:
https://bugs.launchpad.net/testtools/+bug/788974/+subscriptions


References