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

Method test_parametrize_request_name

testing/python/metafunc.py:182–193  ·  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

180 metafunc.parametrize("x", [1], scope="doggy") # type: ignore[arg-type]
181
182 def test_parametrize_request_name(self, pytester: Pytester) -> None:
183 """Show proper error when 'request' is used as a parameter name in parametrize (#6183)"""
184
185 def func(request):
186 raise NotImplementedError()
187
188 metafunc = self.Metafunc(func)
189 with pytest.raises(
190 fail.Exception,
191 match=r"'request' is a reserved name and cannot be used in @pytest.mark.parametrize",
192 ):
193 metafunc.parametrize("request", [1])
194
195 def test_find_parametrized_scope(self) -> None:
196 """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