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

Method test_idfn_marker

testing/python/integration.py:431–450  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

429 """#351"""
430
431 def test_idfn_marker(self, pytester: Pytester) -> None:
432 pytester.makepyfile(
433 """
434 import pytest
435
436 def idfn(param):
437 if param == 0:
438 return 'spam'
439 elif param == 1:
440 return 'ham'
441 else:
442 return None
443
444 @pytest.mark.parametrize('a,b', [(0, 2), (1, 2)], ids=idfn)
445 def test_params(a, b):
446 pass
447 """
448 )
449 res = pytester.runpytest("--collect-only")
450 res.stdout.fnmatch_lines(["*spam-2*", "*ham-2*"])
451
452 def test_idfn_fixture(self, pytester: Pytester) -> None:
453 pytester.makepyfile(

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected