MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_customized_python_discovery

Function test_customized_python_discovery

testing/python/collect.py:1208–1235  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

1206
1207
1208def test_customized_python_discovery(pytester: Pytester) -> None:
1209 pytester.makeini(
1210 """
1211 [pytest]
1212 python_files=check_*.py
1213 python_classes=Check
1214 python_functions=check
1215 """
1216 )
1217 p = pytester.makepyfile(
1218 """
1219 def check_simple():
1220 pass
1221 class CheckMyApp(object):
1222 def check_meth(self):
1223 pass
1224 """
1225 )
1226 p2 = p.with_name(p.name.replace("test", "check"))
1227 p.rename(p2)
1228 result = pytester.runpytest("--collect-only", "-s")
1229 result.stdout.fnmatch_lines(
1230 ["*check_customized*", "*check_simple*", "*CheckMyApp*", "*check_meth*"]
1231 )
1232
1233 result = pytester.runpytest()
1234 assert result.ret == 0
1235 result.stdout.fnmatch_lines(["*2 passed*"])
1236
1237
1238def test_customized_python_discovery_functions(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 4

fnmatch_linesMethod · 0.80
makeiniMethod · 0.45
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected