don't visit '_' attributes on python objects for calling hooks
--HG-- branch : trunk
This commit is contained in:
parent
118eebb190
commit
9ac4faf3af
|
@ -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):
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
Loading…
Reference in New Issue