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

Method test_two_functions

testing/python/metafunc.py:1025–1047  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

1023 result.assert_outcomes(passed=2)
1024
1025 def test_two_functions(self, pytester: Pytester) -> None:
1026 p = pytester.makepyfile(
1027 """
1028 def pytest_generate_tests(metafunc):
1029 metafunc.parametrize('arg1', [10, 20], ids=['0', '1'])
1030
1031 def test_func1(arg1):
1032 assert arg1 == 10
1033
1034 def test_func2(arg1):
1035 assert arg1 in (10, 20)
1036 """
1037 )
1038 result = pytester.runpytest("-v", p)
1039 result.stdout.fnmatch_lines(
1040 [
1041 "*test_func1*0*PASS*",
1042 "*test_func1*1*FAIL*",
1043 "*test_func2*PASS*",
1044 "*test_func2*PASS*",
1045 "*1 failed, 3 passed*",
1046 ]
1047 )
1048
1049 def test_noself_in_method(self, pytester: Pytester) -> None:
1050 p = 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