Remove check for "_" prefix on python functions (use python_functions)
(See IRC hpk 2012-11-27 14:56: after the python_functions customization was introduced, it makes sense to disregard the preliminary "_" check)
This commit is contained in:
parent
ffb5b8efa1
commit
1d7c71884e
|
@ -277,7 +277,6 @@ class PyCollector(PyobjMixin, pytest.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 None:
|
if res is None:
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -659,6 +659,28 @@ def test_customized_python_discovery(testdir):
|
||||||
"*2 passed*",
|
"*2 passed*",
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
def test_customized_python_discovery_functions(testdir):
|
||||||
|
testdir.makeini("""
|
||||||
|
[pytest]
|
||||||
|
python_functions=_test
|
||||||
|
""")
|
||||||
|
p = testdir.makepyfile("""
|
||||||
|
def _test_underscore():
|
||||||
|
pass
|
||||||
|
""")
|
||||||
|
result = testdir.runpytest("--collectonly", "-s")
|
||||||
|
result.stdout.fnmatch_lines([
|
||||||
|
"*_test_underscore*",
|
||||||
|
])
|
||||||
|
|
||||||
|
result = testdir.runpytest()
|
||||||
|
assert result.ret == 0
|
||||||
|
result.stdout.fnmatch_lines([
|
||||||
|
"*1 passed*",
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
def test_collector_attributes(testdir):
|
def test_collector_attributes(testdir):
|
||||||
testdir.makeconftest("""
|
testdir.makeconftest("""
|
||||||
import pytest
|
import pytest
|
||||||
|
|
Loading…
Reference in New Issue