[svn r62287] By default cut traceback such that py lib code does not appear

test tracebacks.

--HG--
branch : trunk
This commit is contained in:
hpk
2009-03-01 12:24:52 +01:00
parent 9d9a94ce00
commit d47ae0dc8d
9 changed files with 26 additions and 11 deletions

View File

@@ -108,6 +108,15 @@ class TestTraceback_f_g_h:
newtraceback = traceback.cut(path=path, lineno=firstlineno+2)
assert len(newtraceback) == 1
def test_traceback_cut_excludepath(self, testdir):
p = testdir.makepyfile("def f(): raise ValueError")
excinfo = py.test.raises(ValueError, "p.pyimport().f()")
print excinfo.traceback
pydir = py.path.local(py.__file__).dirpath()
newtraceback = excinfo.traceback.cut(excludepath=pydir)
assert len(newtraceback) == 1
assert newtraceback[0].frame.code.path == p
def test_traceback_filter(self):
traceback = self.excinfo.traceback
ntraceback = traceback.filter()