MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_conftest_import_error_repr

Function test_conftest_import_error_repr

testing/test_config.py:1987–2000  ·  view source on GitHub ↗

`ConftestImportFailure` should use a short error message and readable path to the failed conftest.py file.

(tmp_path: Path)

Source from the content-addressed store, hash-verified

1985
1986
1987def test_conftest_import_error_repr(tmp_path: Path) -> None:
1988 """`ConftestImportFailure` should use a short error message and readable
1989 path to the failed conftest.py file."""
1990 path = tmp_path.joinpath("foo/conftest.py")
1991 with pytest.raises(
1992 ConftestImportFailure,
1993 match=re.escape(f"RuntimeError: some error (from {path})"),
1994 ):
1995 try:
1996 raise RuntimeError("some error")
1997 except Exception as exc:
1998 assert exc.__traceback__ is not None
1999 exc_info = (type(exc), exc, exc.__traceback__)
2000 raise ConftestImportFailure(path, exc_info) from exc
2001
2002
2003def test_strtobool() -> None:

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected