don't visit '_' attributes on python objects for calling hooks
--HG-- branch : trunk
This commit is contained in:
parent
118eebb190
commit
9ac4faf3af
|
@ -109,6 +109,7 @@ class PyCollectorMixin(PyobjMixin, py.test.collect.Collector):
|
||||||
if name in seen:
|
if name in seen:
|
||||||
continue
|
continue
|
||||||
seen[name] = True
|
seen[name] = True
|
||||||
|
if name[0] != "_":
|
||||||
res = self.makeitem(name, obj)
|
res = self.makeitem(name, obj)
|
||||||
if res is not None:
|
if res is not None:
|
||||||
d[name] = res
|
d[name] = res
|
||||||
|
|
|
@ -389,6 +389,14 @@ class TestConftestCustomization:
|
||||||
assert len(colitems) == 1
|
assert len(colitems) == 1
|
||||||
assert colitems[0].name == "check_method"
|
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:
|
class TestReportinfo:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue