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

Method test_parametrize_functional

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

Source from the content-addressed store, hash-verified

852 )
853
854 def test_parametrize_functional(self, pytester: Pytester) -> None:
855 pytester.makepyfile(
856 """
857 import pytest
858 def pytest_generate_tests(metafunc):
859 metafunc.parametrize('x', [1,2], indirect=True)
860 metafunc.parametrize('y', [2])
861 @pytest.fixture
862 def x(request):
863 return request.param * 10
864
865 def test_simple(x,y):
866 assert x in (10,20)
867 assert y == 2
868 """
869 )
870 result = pytester.runpytest("-v")
871 result.stdout.fnmatch_lines(
872 ["*test_simple*1-2*", "*test_simple*2-2*", "*2 passed*"]
873 )
874
875 def test_parametrize_onearg(self) -> None:
876 metafunc = self.Metafunc(lambda x: None)

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected