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

Method test_parametrize_request_name

testing/python/metafunc.py:127–138  ·  view source on GitHub ↗

Show proper error when 'request' is used as a parameter name in parametrize (#6183)

(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

125 metafunc.parametrize("x", [1], scope="doggy") # type: ignore[arg-type]
126
127 def test_parametrize_request_name(self, pytester: Pytester) -> None:
128 """Show proper error when 'request' is used as a parameter name in parametrize (#6183)"""
129
130 def func(request):
131 raise NotImplementedError()
132
133 metafunc = self.Metafunc(func)
134 with pytest.raises(
135 fail.Exception,
136 match=r"'request' is a reserved name and cannot be used in @pytest.mark.parametrize",
137 ):
138 metafunc.parametrize("request", [1])
139
140 def test_find_parametrized_scope(self) -> None:
141 """Unit test for _find_parametrized_scope (#3941)."""

Callers

nothing calls this directly

Calls 2

MetafuncMethod · 0.95
parametrizeMethod · 0.95

Tested by

no test coverage detected