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

Method test_parametrize_with_mark

testing/python/collect.py:496–515  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

494 rec.assertoutcome(passed=1)
495
496 def test_parametrize_with_mark(self, pytester: Pytester) -> None:
497 items = pytester.getitems(
498 """
499 import pytest
500 @pytest.mark.foo
501 @pytest.mark.parametrize('arg', [
502 1,
503 pytest.param(2, marks=[pytest.mark.baz, pytest.mark.bar])
504 ])
505 def test_function(arg):
506 pass
507 """
508 )
509 keywords = [item.keywords for item in items]
510 assert (
511 "foo" in keywords[0]
512 and "bar" not in keywords[0]
513 and "baz" not in keywords[0]
514 )
515 assert "foo" in keywords[1] and "bar" in keywords[1] and "baz" in keywords[1]
516
517 def test_parametrize_with_empty_string_arguments(self, pytester: Pytester) -> None:
518 items = pytester.getitems(

Callers

nothing calls this directly

Calls 1

getitemsMethod · 0.45

Tested by

no test coverage detected