diff options
author | Ran Benita <ran@unusedvar.com> | 2020-04-29 15:51:14 +0300 |
---|---|---|
committer | Ran Benita <ran@unusedvar.com> | 2020-04-30 16:44:02 +0300 |
commit | a6819726cdaf05a479fcc5f74d2f091f85b672c7 (patch) | |
tree | 0451620a526669d3daa948ff9e5287ebc80e1829 /src/_pytest/_io | |
parent | b6cc90e0afe90c84d84c5b15a2db75d87a2681d7 (diff) | |
download | pytest-a6819726cdaf05a479fcc5f74d2f091f85b672c7.tar.gz |
terminalwriter: remove unused function ansi_print
Diffstat (limited to 'src/_pytest/_io')
-rw-r--r-- | src/_pytest/_io/terminalwriter.py | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/_pytest/_io/terminalwriter.py b/src/_pytest/_io/terminalwriter.py index 0e7f0ccff..6e77f2ebf 100644 --- a/src/_pytest/_io/terminalwriter.py +++ b/src/_pytest/_io/terminalwriter.py @@ -45,62 +45,6 @@ def get_line_width(text): return sum(char_width(c) for c in text) -# XXX unify with _escaped func below -def ansi_print(text, esc, file=None, newline=True, flush=False): - if file is None: - file = sys.stderr - text = text.rstrip() - if esc and not isinstance(esc, tuple): - esc = (esc,) - if esc and sys.platform != "win32" and file.isatty(): - text = ( - "".join(["\x1b[%sm" % cod for cod in esc]) + text + "\x1b[0m" - ) # ANSI color code "reset" - if newline: - text += "\n" - - if esc and win32_and_ctypes and file.isatty(): - if 1 in esc: - bold = True - esc = tuple([x for x in esc if x != 1]) - else: - bold = False - esctable = { - (): FOREGROUND_WHITE, # normal - (31,): FOREGROUND_RED, # red - (32,): FOREGROUND_GREEN, # green - (33,): FOREGROUND_GREEN | FOREGROUND_RED, # yellow - (34,): FOREGROUND_BLUE, # blue - (35,): FOREGROUND_BLUE | FOREGROUND_RED, # purple - (36,): FOREGROUND_BLUE | FOREGROUND_GREEN, # cyan - (37,): FOREGROUND_WHITE, # white - (39,): FOREGROUND_WHITE, # reset - } - attr = esctable.get(esc, FOREGROUND_WHITE) - if bold: - attr |= FOREGROUND_INTENSITY - STD_OUTPUT_HANDLE = -11 - STD_ERROR_HANDLE = -12 - if file is sys.stderr: - handle = GetStdHandle(STD_ERROR_HANDLE) - else: - handle = GetStdHandle(STD_OUTPUT_HANDLE) - oldcolors = GetConsoleInfo(handle).wAttributes - attr |= oldcolors & 0x0F0 - SetConsoleTextAttribute(handle, attr) - while len(text) > 32768: - file.write(text[:32768]) - text = text[32768:] - if text: - file.write(text) - SetConsoleTextAttribute(handle, oldcolors) - else: - file.write(text) - - if flush: - file.flush() - - def should_do_markup(file): if os.environ.get("PY_COLORS") == "1": return True |