(self, pytester: Pytester)
| 928 | reprec.assertoutcome(passed=2) |
| 929 | |
| 930 | def test_parametrize_class_scenarios(self, pytester: Pytester) -> None: |
| 931 | pytester.makepyfile( |
| 932 | """ |
| 933 | # same as doc/en/example/parametrize scenario example |
| 934 | def pytest_generate_tests(metafunc): |
| 935 | idlist = [] |
| 936 | argvalues = [] |
| 937 | for scenario in metafunc.cls.scenarios: |
| 938 | idlist.append(scenario[0]) |
| 939 | items = scenario[1].items() |
| 940 | argnames = [x[0] for x in items] |
| 941 | argvalues.append(([x[1] for x in items])) |
| 942 | metafunc.parametrize(argnames, argvalues, ids=idlist, scope="class") |
| 943 | |
| 944 | class Test(object): |
| 945 | scenarios = [['1', {'arg': {1: 2}, "arg2": "value2"}], |
| 946 | ['2', {'arg':'value2', "arg2": "value2"}]] |
| 947 | |
| 948 | def test_1(self, arg, arg2): |
| 949 | pass |
| 950 | |
| 951 | def test_2(self, arg2, arg): |
| 952 | pass |
| 953 | |
| 954 | def test_3(self, arg, arg2): |
| 955 | pass |
| 956 | """ |
| 957 | ) |
| 958 | result = pytester.runpytest("-v") |
| 959 | assert result.ret == 0 |
| 960 | result.stdout.fnmatch_lines( |
| 961 | """ |
| 962 | *test_1*1* |
| 963 | *test_2*1* |
| 964 | *test_3*1* |
| 965 | *test_1*2* |
| 966 | *test_2*2* |
| 967 | *test_3*2* |
| 968 | *6 passed* |
| 969 | """ |
| 970 | ) |
| 971 | |
| 972 | def test_format_args(self) -> None: |
| 973 | def function1(): |
nothing calls this directly
no test coverage detected