refine excludepath handling to treat entries with no path as matching
--HG-- branch : trunk
This commit is contained in:
parent
89068d9471
commit
0149771997
|
@ -293,8 +293,8 @@ class Traceback(list):
|
||||||
code = x.frame.code
|
code = x.frame.code
|
||||||
codepath = code.path
|
codepath = code.path
|
||||||
if ((path is None or codepath == path) and
|
if ((path is None or codepath == path) and
|
||||||
(excludepath is None or (hasattr(codepath, 'relto') and
|
(excludepath is None or not hasattr(codepath, 'relto') or
|
||||||
not codepath.relto(excludepath))) and
|
not codepath.relto(excludepath)) and
|
||||||
(lineno is None or x.lineno == lineno) and
|
(lineno is None or x.lineno == lineno) and
|
||||||
(firstlineno is None or x.frame.code.firstlineno == firstlineno)):
|
(firstlineno is None or x.frame.code.firstlineno == firstlineno)):
|
||||||
return Traceback(x._rawentry)
|
return Traceback(x._rawentry)
|
||||||
|
|
|
@ -114,8 +114,10 @@ class TestTraceback_f_g_h:
|
||||||
excinfo = py.test.raises(ValueError, "p.pyimport().f()")
|
excinfo = py.test.raises(ValueError, "p.pyimport().f()")
|
||||||
basedir = py._pydir
|
basedir = py._pydir
|
||||||
newtraceback = excinfo.traceback.cut(excludepath=basedir)
|
newtraceback = excinfo.traceback.cut(excludepath=basedir)
|
||||||
assert len(newtraceback) == 1
|
for x in newtraceback:
|
||||||
assert newtraceback[0].frame.code.path == p
|
if hasattr(x, 'path'):
|
||||||
|
assert not py.path.local(x.path).relto(basedir)
|
||||||
|
assert newtraceback[-1].frame.code.path == p
|
||||||
|
|
||||||
def test_traceback_filter(self):
|
def test_traceback_filter(self):
|
||||||
traceback = self.excinfo.traceback
|
traceback = self.excinfo.traceback
|
||||||
|
|
Loading…
Reference in New Issue