don't visit '_' attributes on python objects for calling hooks

--HG--
branch : trunk
This commit is contained in:
holger krekel 2009-10-21 18:44:12 +02:00
parent 118eebb190
commit 9ac4faf3af
2 changed files with 12 additions and 3 deletions

View File

@ -109,9 +109,10 @@ class PyCollectorMixin(PyobjMixin, py.test.collect.Collector):
if name in seen:
continue
seen[name] = True
res = self.makeitem(name, obj)
if res is not None:
d[name] = res
if name[0] != "_":
res = self.makeitem(name, obj)
if res is not None:
d[name] = res
return d
def _deprecated_join(self, name):

View File

@ -389,6 +389,14 @@ class TestConftestCustomization:
assert len(colitems) == 1
assert colitems[0].name == "check_method"
def test_makeitem_non_underscore(self, testdir, monkeypatch):
modcol = testdir.getmodulecol("def _hello(): pass")
l = []
monkeypatch.setattr(py.test.collect.Module, 'makeitem',
lambda self, name, obj: l.append(name))
modcol._buildname2items()
assert '_hello' not in l
class TestReportinfo: