(pytester: Pytester)
| 1024 | |
| 1025 | |
| 1026 | def test_parameterset_for_fail_at_collect(pytester: Pytester) -> None: |
| 1027 | pytester.makeini( |
| 1028 | f""" |
| 1029 | [pytest] |
| 1030 | {EMPTY_PARAMETERSET_OPTION}=fail_at_collect |
| 1031 | """ |
| 1032 | ) |
| 1033 | |
| 1034 | config = pytester.parseconfig() |
| 1035 | from _pytest.mark import get_empty_parameterset_mark |
| 1036 | from _pytest.mark import pytest_configure |
| 1037 | |
| 1038 | pytest_configure(config) |
| 1039 | |
| 1040 | with pytest.raises( |
| 1041 | Collector.CollectError, |
| 1042 | match=r"Empty parameter set in 'pytest_configure' at line \d\d+", |
| 1043 | ): |
| 1044 | get_empty_parameterset_mark(config, ["a"], pytest_configure) |
| 1045 | |
| 1046 | p1 = pytester.makepyfile( |
| 1047 | """ |
| 1048 | import pytest |
| 1049 | |
| 1050 | @pytest.mark.parametrize("empty", []) |
| 1051 | def test(): |
| 1052 | pass |
| 1053 | """ |
| 1054 | ) |
| 1055 | result = pytester.runpytest(str(p1)) |
| 1056 | result.stdout.fnmatch_lines( |
| 1057 | [ |
| 1058 | "collected 0 items / 1 error", |
| 1059 | "* ERROR collecting test_parameterset_for_fail_at_collect.py *", |
| 1060 | "Empty parameter set in 'test' at line 3", |
| 1061 | "*= 1 error in *", |
| 1062 | ] |
| 1063 | ) |
| 1064 | assert result.ret == ExitCode.INTERRUPTED |
| 1065 | |
| 1066 | |
| 1067 | def test_paramset_empty_no_idfunc( |
nothing calls this directly
no test coverage detected
searching dependent graphs…