MCPcopy
hub / github.com/pytest-dev/pytest / test_customized_python_discovery

Function test_customized_python_discovery

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

Source from the content-addressed store, hash-verified

1320
1321
1322def test_customized_python_discovery(pytester: Pytester) -> None:
1323 pytester.makeini(
1324 """
1325 [pytest]
1326 python_files=check_*.py
1327 python_classes=Check
1328 python_functions=check
1329 """
1330 )
1331 p = pytester.makepyfile(
1332 """
1333 def check_simple():
1334 pass
1335 class CheckMyApp(object):
1336 def check_meth(self):
1337 pass
1338 """
1339 )
1340 p2 = p.with_name(p.name.replace("test", "check"))
1341 p.rename(p2)
1342 result = pytester.runpytest("--collect-only", "-s")
1343 result.stdout.fnmatch_lines(
1344 ["*check_customized*", "*check_simple*", "*CheckMyApp*", "*check_meth*"]
1345 )
1346
1347 result = pytester.runpytest()
1348 assert result.ret == 0
1349 result.stdout.fnmatch_lines(["*2 passed*"])
1350
1351
1352def test_customized_python_discovery_functions(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…