#3605
(pytester: Pytester)
| 1065 | |
| 1066 | @pytest.mark.filterwarnings("ignore") |
| 1067 | def test_markers_from_parametrize(pytester: Pytester) -> None: |
| 1068 | """#3605""" |
| 1069 | pytester.makepyfile( |
| 1070 | """ |
| 1071 | import pytest |
| 1072 | |
| 1073 | first_custom_mark = pytest.mark.custom_marker |
| 1074 | custom_mark = pytest.mark.custom_mark |
| 1075 | @pytest.fixture(autouse=True) |
| 1076 | def trigger(request): |
| 1077 | custom_mark = list(request.node.iter_markers('custom_mark')) |
| 1078 | print("Custom mark %s" % custom_mark) |
| 1079 | |
| 1080 | @custom_mark("custom mark non parametrized") |
| 1081 | def test_custom_mark_non_parametrized(): |
| 1082 | print("Hey from test") |
| 1083 | |
| 1084 | @pytest.mark.parametrize( |
| 1085 | "obj_type", |
| 1086 | [ |
| 1087 | first_custom_mark("first custom mark")("template"), |
| 1088 | pytest.param( # Think this should be recommended way? |
| 1089 | "disk", |
| 1090 | marks=custom_mark('custom mark1') |
| 1091 | ), |
| 1092 | custom_mark("custom mark2")("vm"), # Tried also this |
| 1093 | ] |
| 1094 | ) |
| 1095 | def test_custom_mark_parametrized(obj_type): |
| 1096 | print("obj_type is:", obj_type) |
| 1097 | """ |
| 1098 | ) |
| 1099 | |
| 1100 | result = pytester.runpytest() |
| 1101 | result.assert_outcomes(passed=4) |
| 1102 | |
| 1103 | |
| 1104 | def test_pytest_param_id_requires_string() -> None: |
nothing calls this directly
no test coverage detected