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

Function test_parametrized_collect_with_wrong_args

testing/test_mark.py:406–426  ·  view source on GitHub ↗

Test collect parametrized func with wrong number of args.

(pytester: Pytester)

Source from the content-addressed store, hash-verified

404
405
406def test_parametrized_collect_with_wrong_args(pytester: Pytester) -> None:
407 """Test collect parametrized func with wrong number of args."""
408 py_file = pytester.makepyfile(
409 """
410 import pytest
411
412 @pytest.mark.parametrize('foo, bar', [(1, 2, 3)])
413 def test_func(foo, bar):
414 pass
415 """
416 )
417
418 result = pytester.runpytest(py_file)
419 result.stdout.fnmatch_lines(
420 [
421 'test_parametrized_collect_with_wrong_args.py::test_func: in "parametrize" the number of names (2):',
422 " ['foo', 'bar']",
423 "must be equal to the number of values (3):",
424 " (1, 2, 3)",
425 ]
426 )
427
428
429def test_parametrized_with_kwargs(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected