(pytester: Pytester)
| 968 | |
| 969 | |
| 970 | def test_parameterset_for_fail_at_collect(pytester: Pytester) -> None: |
| 971 | pytester.makeini( |
| 972 | """ |
| 973 | [pytest] |
| 974 | {}=fail_at_collect |
| 975 | """.format( |
| 976 | EMPTY_PARAMETERSET_OPTION |
| 977 | ) |
| 978 | ) |
| 979 | |
| 980 | config = pytester.parseconfig() |
| 981 | from _pytest.mark import pytest_configure, get_empty_parameterset_mark |
| 982 | |
| 983 | pytest_configure(config) |
| 984 | |
| 985 | with pytest.raises( |
| 986 | Collector.CollectError, |
| 987 | match=r"Empty parameter set in 'pytest_configure' at line \d\d+", |
| 988 | ): |
| 989 | get_empty_parameterset_mark(config, ["a"], pytest_configure) |
| 990 | |
| 991 | p1 = pytester.makepyfile( |
| 992 | """ |
| 993 | import pytest |
| 994 | |
| 995 | @pytest.mark.parametrize("empty", []) |
| 996 | def test(): |
| 997 | pass |
| 998 | """ |
| 999 | ) |
| 1000 | result = pytester.runpytest(str(p1)) |
| 1001 | result.stdout.fnmatch_lines( |
| 1002 | [ |
| 1003 | "collected 0 items / 1 error", |
| 1004 | "* ERROR collecting test_parameterset_for_fail_at_collect.py *", |
| 1005 | "Empty parameter set in 'test' at line 3", |
| 1006 | "*= 1 error in *", |
| 1007 | ] |
| 1008 | ) |
| 1009 | assert result.ret == ExitCode.INTERRUPTED |
| 1010 | |
| 1011 | |
| 1012 | def test_parameterset_for_parametrize_bad_markname(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected