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

Function should_do_markup

src/_pytest/_io/terminalwriter.py:36–47  ·  view source on GitHub ↗
(file: TextIO)

Source from the content-addressed store, hash-verified

34
35
36def should_do_markup(file: TextIO) -> bool:
37 if os.environ.get("PY_COLORS") == "1":
38 return True
39 if os.environ.get("PY_COLORS") == "0":
40 return False
41 if os.environ.get("NO_COLOR"):
42 return False
43 if os.environ.get("FORCE_COLOR"):
44 return True
45 return (
46 hasattr(file, "isatty") and file.isatty() and os.environ.get("TERM") != "dumb"
47 )
48
49
50@final

Callers 1

__init__Method · 0.85

Calls 2

getMethod · 0.45
isattyMethod · 0.45

Tested by

no test coverage detected