I'd like the ability to hide or condense traceback output from 'uninteresting' modules.
A specific use case I have is running some tests using urllib2. When there is an HTTP error, py.test gives me a traceback of a bunch of urllib2 internals, where all I really need is the line in my code that called urllib2.urlopen -- I don't need the code samples for each function in urllib2 that elevated the exception.
The sticky point is how to define 'uninteresting'. Some options include:
- Not displaying code samples for standard library code, or for code that isn't in my working directory.
- Configuration options to disable certain modules as they come up. Deep tracebacks as found in urllib2 are not that common.
- Call something like py.test.no_codesample('urllib2') inside test functions to disable the code samples/traceback
Here's a simple example test to trigger a longish traceback:
def test_traceback(): stream = urllib2.urlopen('http://example.com/file/not/exist/404.html') content = stream.read()