MCPcopy Index your code
hub / github.com/pytest-dev/pytest / test_parametrize_with_mark

Method test_parametrize_with_mark

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

Source from the content-addressed store, hash-verified

598 rec.assertoutcome(passed=1)
599
600 def test_parametrize_with_mark(self, pytester: Pytester) -> None:
601 items = pytester.getitems(
602 """
603 import pytest
604 @pytest.mark.foo
605 @pytest.mark.parametrize('arg', [
606 1,
607 pytest.param(2, marks=[pytest.mark.baz, pytest.mark.bar])
608 ])
609 def test_function(arg):
610 pass
611 """
612 )
613 keywords = [item.keywords for item in items]
614 assert (
615 "foo" in keywords[0]
616 and "bar" not in keywords[0]
617 and "baz" not in keywords[0]
618 )
619 assert "foo" in keywords[1] and "bar" in keywords[1] and "baz" in keywords[1]
620
621 def test_parametrize_with_empty_string_arguments(self, pytester: Pytester) -> None:
622 items = pytester.getitems(

Callers

nothing calls this directly

Calls 1

getitemsMethod · 0.45

Tested by

no test coverage detected