Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion btest
Original file line number Diff line number Diff line change
Expand Up @@ -2380,7 +2380,7 @@ def create_output_handler(options):
output_handlers += [Brief(options)]

else:
if sys.stdout.isatty():
if sys.stdout.isatty() or os.getenv("BTEST_FORCE_CONSOLE_OUTPUT", "0") == "1":

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about adding a proper option for this, and also reading a default from the environment like we do for --progress-bar?

btest/btest

Lines 3026 to 3033 in 1e97bbe

optparser.add_option(
"-P",
"--progress-bar",
action="store_true",
dest="osc94_progress",
default=os.environ.get("BTEST_OSC94_PROGRESS", ""),
help="display progress bar using OSC 9;4 escape sequences (set BTEST_OSC94_PROGRESS to permanently enable)",
)

It would also be nice to add a test for this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree — my suggestion would be to expand this PR a little bit. How about:

  • add --tty to force console use
  • use BTEST_FORCE_TTY as the corresponding variable
  • wrap sys.stdout.isatty() or os.getenv("BTEST_FORCE_TTY") into a helper and use that instead of sys.stdout.isatty(). We have multiple of these and I'm not sure e.g. --progress works reliably in that Windows setting either.

If you have it in you it would also be handy to get a summary of supported BTEST_* env vars in the help output. I just had to remind myself and there are more than I would have come up with. :-)

if options.show_all:
output_handlers += [Console(options)]
else:
Expand Down
Loading