MCPcopy
hub / github.com/pytest-dev/pytest / print_conftest_import_error

Function print_conftest_import_error

src/_pytest/config/__init__.py:152–166  ·  view source on GitHub ↗
(e: ConftestImportFailure, file: TextIO)

Source from the content-addressed store, hash-verified

150
151
152def print_conftest_import_error(e: ConftestImportFailure, file: TextIO) -> None:
153 exc_info = ExceptionInfo.from_exception(e.cause)
154 tw = TerminalWriter(file)
155 tw.line(f"ImportError while loading conftest '{e.path}'.", red=True)
156 exc_info.traceback = exc_info.traceback.filter(
157 filter_traceback_for_conftest_import_failure
158 )
159 exc_repr = (
160 exc_info.getrepr(style="short", chain=False)
161 if exc_info.traceback
162 else exc_info.exconly()
163 )
164 formatted_tb = str(exc_repr)
165 for line in formatted_tb.splitlines():
166 tw.line(line.rstrip(), red=True)
167
168
169def print_usage_error(e: UsageError, file: TextIO) -> None:

Callers 1

_mainFunction · 0.85

Calls 6

lineMethod · 0.95
TerminalWriterClass · 0.90
from_exceptionMethod · 0.80
getreprMethod · 0.80
exconlyMethod · 0.80
filterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…