[py-svn] py-trunk commit 9a14e7af3e38: refine excludepath handling to treat entries with no path as matching
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon Jan 18 03:04:38 CET 2010
# HG changeset patch -- Bitbucket.org
# Project py-trunk
# URL http://bitbucket.org/hpk42/py-trunk/overview/
# User holger krekel <holger at merlinux.eu>
# Date 1263780260 -3600
# Node ID 9a14e7af3e386f48c1e549cd3c975f95d881621a
# Parent 83ddfaf24fffa02be51c7a749ad2866b90a94a07
refine excludepath handling to treat entries with no path as matching
--- a/py/_code/code.py
+++ b/py/_code/code.py
@@ -293,8 +293,8 @@ class Traceback(list):
code = x.frame.code
codepath = code.path
if ((path is None or codepath == path) and
- (excludepath is None or (hasattr(codepath, 'relto') and
- not codepath.relto(excludepath))) and
+ (excludepath is None or not hasattr(codepath, 'relto') or
+ not codepath.relto(excludepath)) and
(lineno is None or x.lineno == lineno) and
(firstlineno is None or x.frame.code.firstlineno == firstlineno)):
return Traceback(x._rawentry)
--- a/testing/code/test_excinfo.py
+++ b/testing/code/test_excinfo.py
@@ -114,8 +114,10 @@ class TestTraceback_f_g_h:
excinfo = py.test.raises(ValueError, "p.pyimport().f()")
basedir = py._pydir
newtraceback = excinfo.traceback.cut(excludepath=basedir)
- assert len(newtraceback) == 1
- assert newtraceback[0].frame.code.path == p
+ for x in newtraceback:
+ 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):
traceback = self.excinfo.traceback
More information about the pytest-commit
mailing list