[7.0.x] Improve error message for malformed pyproject.toml files

This commit is contained in:
Anthony Sottile
2022-03-06 10:01:13 -05:00
committed by pytest bot
parent c0a03a247f
commit b1f9e58196
3 changed files with 13 additions and 2 deletions

View File

@@ -163,7 +163,17 @@ class TestParseIni:
pytester.path.joinpath("pytest.ini").write_text("addopts = -x")
result = pytester.runpytest()
assert result.ret != 0
result.stderr.fnmatch_lines(["ERROR: *pytest.ini:1: no section header defined"])
result.stderr.fnmatch_lines("ERROR: *pytest.ini:1: no section header defined")
def test_toml_parse_error(self, pytester: Pytester) -> None:
pytester.makepyprojecttoml(
"""
\\"
"""
)
result = pytester.runpytest()
assert result.ret != 0
result.stderr.fnmatch_lines("ERROR: *pyproject.toml: Invalid statement*")
@pytest.mark.xfail(reason="probably not needed")
def test_confcutdir(self, pytester: Pytester) -> None: