tests.test_progress module¶

tests.test_progress.test_progressbar_follows_progress_flag(invoke, args, expected_hidden)[source]¶

click_extra.progressbar gates hidden on the resolved –progress flag.

tests.test_progress.test_progressbar_explicit_hidden_overrides_flag(invoke, forced)[source]¶

An explicit hidden= wins over –no-progress, like echo(color=…).

tests.test_progress.test_progressbar_shown_without_active_context()[source]¶

Outside a Click command the bar defaults to shown, like click.progressbar.

tests.test_progress.test_progressbar_label_emission_off_tty(invoke, args, label_shown)[source]¶

Off a TTY a shown bar still emits its label once; a hidden one emits nothing.

tests.test_progress.test_progressbar_shows_final_position_with_update_min_steps()[source]¶

With an update_min_steps that does not divide the length, the bar still lands on total/total instead of the last multiple (14/20 for a length of 20 and an update_min_steps of 7).

tests.test_progress.test_progressbar_prints_a_log_record_above_itself(monkeypatch)[source]¶

A record logged while a bar draws lands on a line of its own, above it.

Click draws a bar with a carriage return and no line feed until it finishes, so a record written in between continued the bar’s row, after its position.

tests.test_progress.LOGGING_UNDER_A_BAR_SCRIPT = '\nimport logging\nimport time\n\nfrom click_extra import command, progressbar\n\n\n@command\ndef sort_plums():\n    with progressbar(range(3), label="Sorting plums") as bar:\n        for _ in bar:\n            logging.warning("Opening the fruit basket")\n            time.sleep(0.05)\n\n\nsort_plums()\n'¶

A CLI logging from inside an open progress bar.

tests.test_progress.test_progressbar_logging_on_a_pseudo_terminal()[source]¶

On a real terminal, each record a CLI logs under a bar gets its own row.

tests.test_progress.test_progressbar_draws_on_stderr_by_default()[source]¶

The bar draws where log records and the other live lines go.

tests.test_progress.test_progressbar_draws_fast_items_once_per_interval()[source]¶

Items faster than the interval draw nothing between the first and the last position, however many there are.

tests.test_progress.test_progressbar_draws_every_slow_item()[source]¶

Items slower than the interval each draw their position, so a bar over slow items never looks frozen.

tests.test_progress.test_progressbar_keeps_an_explicit_update_min_steps()[source]¶

A caller stating update_min_steps keeps Click’s gate on a count of items.

tests.test_progress.test_progressbar_show_eta_follows_time_flag()[source]¶

The bar’s ETA follows –time by default; an explicit show_eta wins.