From 7e85e782bc24fa487d77aff3356eaf04db764d21 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 6 Feb 2022 17:42:53 -0500 Subject: debug: pybehave is now an option on `coverage debug` --- coverage/debug.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'coverage/debug.py') diff --git a/coverage/debug.py b/coverage/debug.py index e6f93aa6..8c5e3839 100644 --- a/coverage/debug.py +++ b/coverage/debug.py @@ -130,17 +130,18 @@ def info_formatter(info): yield "%*s: %s" % (label_len, label, data) -def write_formatted_info(writer, header, info): +def write_formatted_info(write, header, info): """Write a sequence of (label,data) pairs nicely. - `writer` has a .write(str) method. `header` is a string to start the - section. `info` is a sequence of (label, data) pairs, where label - is a str, and data can be a single value, or a list/set/tuple. + `write` is a function write(str) that accepts each line of output. + `header` is a string to start the section. `info` is a sequence of + (label, data) pairs, where label is a str, and data can be a single + value, or a list/set/tuple. """ - writer.write(info_header(header)) + write(info_header(header)) for line in info_formatter(info): - writer.write(" %s" % line) + write(f" {line}") def short_stack(limit=None, skip=0): -- cgit v1.2.1