tests.test_trail module

tests.test_trail.test_bar_stop_leaves_a_stalled_ticker_behind(monkeypatch)[source]

The progress bar’s elapsed-clock ticker gets the same bounded stop.

tests.test_trail.test_bar_teardown_after_a_stall_returns_at_once(monkeypatch)[source]

A second teardown of a bar whose ticker stalled does not wait on it.

The stalled ticker holds the draw lock while it blocks in its write. A Ctrl+C inside a trail runs finish(), then stop(), and the second one must not take that lock and wait for the terminal to drain.

tests.test_trail.test_interrupted_trail_closes_with_a_finisher(progress_bar, jobs, stream_factory)[source]

A Ctrl+C inside the trail still ends it on a ✘ line saying how far it got, and an outcome landing afterwards prints below that line.

tests.test_trail.test_demo_trail_help_lists_renderings(invoke)[source]

trail --help documents its purpose and the rendering-selecting options.

tests.test_trail.test_demo_trail_rejects_unknown_spinner(invoke)[source]

An unknown –spinner name is rejected by the Choice type before any work.

tests.test_trail.test_demo_trail_prints_plain_lines_off_tty(invoke, monkeypatch, args)[source]

Every rendering runs the batch to completion and, off a TTY, prints each outcome and the finisher as plain lines, with no indicator drawn.

tests.test_trail.test_operation_trail_exported_from_root()[source]
tests.test_trail.test_trail_line_carries_themed_glyphs()[source]
tests.test_trail.test_trail_marks_a_skipped_operation(rendering)[source]

None marks an operation that neither succeeded nor failed.

Its line takes the skip glyph, and the tally counts it apart from the successes, so the finisher can leave it out of its count.

tests.test_trail.test_drawn_indicator_keeps_a_skipped_finisher(rendering)[source]

A batch that skipped every operation closes a drawn indicator on ⊘.

tests.test_trail.test_sequential_trail_echoes_lines_and_finisher()[source]

A sequential batch on a TTY echoes each outcome, then a timed finisher.

tests.test_trail.test_sequential_trail_echoes_off_tty()[source]

A non-interactive stream gets the trail lines and finisher by default.

tests.test_trail.test_sequential_trail_invisible_stays_silent_off_tty()[source]

visible=False silences the trail on a non-interactive stream too.

tests.test_trail.test_trail_forced_spinner_draws_on_pipe()[source]

live="always" animates the aggregate spinner on a non-interactive stream.

tests.test_trail.test_sequential_trail_echo_opt_out()[source]

echo_sequential=False silences a sequential batch, even on a TTY.

tests.test_trail.test_concurrent_trail_buffers_until_spinner_draws()[source]

Outcomes marked before the aggregate spinner first draws are buffered, then flushed above it; the finisher becomes the spinner’s kept line.

The draw delay guarantees the first mark lands before the first frame, making the buffering deterministic instead of racing the animation thread.

tests.test_trail.test_concurrent_trail_invisible_stays_silent()[source]

visible=False keeps the concurrent spinner and its buffer off screen.

tests.test_trail.test_trail_echoes_a_batch_its_indicator_never_drew(rendering, finished)[source]

A batch finishing inside delay still leaves its whole record on screen.

Its indicator never drew, so the lines it buffered never reached the stream. A sequential batch of the same outcomes prints them, and so must this one, in order: before the finisher, or on its own when the batch is left without one.

tests.test_trail.test_trail_leaves_nothing_for_an_undrawn_batch_without_echo(options, stream_class, finished)[source]

The echo of an undrawn batch obeys the same gates as a sequential one.

tests.test_trail.test_trail_stays_plain_above_a_drawn_indicator_without_color(monkeypatch, rendering)[source]

With color off, a drawn indicator’s trail lines and finisher carry no SGR.

Those lines reach the stream through a raw write rather than click.echo, so the glyph’s paint and any escape embedded in the message have to be stripped before the write.

tests.test_trail.test_concurrent_trail_marks_are_thread_safe()[source]

Concurrent mark() calls from worker threads all land in the tally.

tests.test_trail.test_concurrent_trail_uses_chosen_spinner_preset()[source]

spinner= picks the concurrent aggregate spinner’s animation.

tests.test_trail.test_concurrent_spinner_eta_mode()[source]

clock=’eta’ drives the concurrent spinner’s estimate from a hidden Click bar (stepped per outcome), and the finisher still shows the elapsed total.

tests.test_trail.test_operation_trail_appends_per_operation_timing()[source]

With timer on (the default), a seconds value appends each operation’s own duration to its trail line, independent of the others.

tests.test_trail.test_operation_handle_times_from_its_creation()[source]

An operation() handle marks its outcome with the elapsed since it began.

tests.test_trail.test_operation_trail_timer_false_drops_all_timing()[source]

timer=False silences both the per-item and the finisher clock.

tests.test_trail.test_operation_trail_timer_callable_formats_durations()[source]

A callable timer formats the per-item durations it is handed.

tests.test_trail.test_progress_bar_trail_renders_bar_and_finisher()[source]

progress_bar=True drives a determinate bar with outcomes above it.

tests.test_trail.test_progress_bar_trail_shows_empty_bar_on_entry()[source]

The bar’s 0/total state draws on entry, not only once the first outcome advances it, matching the spinner indicator that animates its tally at once.

tests.test_trail.test_progress_bar_clock_defaults_to_elapsed()[source]

clock=’elapsed’ (the default) draws a stopwatch from the start via item_show_func, with Click’s ETA off and a ticker to keep it moving.

tests.test_trail.test_progress_bar_clock_eta_uses_click_eta()[source]

clock=’eta’ keeps Click’s estimated-time display and runs no ticker.

tests.test_trail.test_progress_bar_elapsed_clock_ticks_between_marks()[source]

The elapsed clock advances on its own between outcomes, with no mark.

tests.test_trail.test_operation_trail_rejects_invalid_clock()[source]

clock must be ‘elapsed’ or ‘eta’.

tests.test_trail.test_operation_trail_rejects_invalid_live()[source]

live must be ‘auto’, ‘always’ or ‘never’.

tests.test_trail.test_invisible_trail_draws_nothing_even_when_live_always()[source]

visible=False wins over live="always": no indicator, no line.

tests.test_trail.test_progress_bar_trail_works_concurrently()[source]

progress_bar=True also drives a concurrent batch from worker threads.

tests.test_trail.test_trail_echoes_live_where_no_indicator_draws(monkeypatch, rendering, stream_class, term, options)[source]

Where no indicator draws, each outcome prints as soon as it is marked.

Nothing owns the live line there, so no line waits for a first frame that never comes, and no cursor control reaches the stream.

tests.test_trail.test_progress_bar_requires_positive_total()[source]

A determinate bar needs a length, so total must be positive.

tests.test_trail.test_progress_bar_and_spinner_are_mutually_exclusive()[source]

progress_bar and spinner select different indicators; only one may win.

tests.test_trail.test_progress_bar_registers_as_active_line_not_spinner()[source]

A drawing bar owns the active line (so logs cooperate), but is no spinner.