`ConftestImportFailure` should use a short error message and readable path to the failed conftest.py file.
(tmp_path: Path)
| 1985 | |
| 1986 | |
| 1987 | def 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 | |
| 2003 | def test_strtobool() -> None: |
nothing calls this directly
no test coverage detected