multiCMD 1.69__tar.gz → 1.70__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {multicmd-1.69 → multicmd-1.70}/PKG-INFO +21 -4
- {multicmd-1.69 → multicmd-1.70}/README.md +20 -3
- {multicmd-1.69 → multicmd-1.70}/multiCMD.egg-info/PKG-INFO +21 -4
- {multicmd-1.69 → multicmd-1.70}/multiCMD.py +34 -12
- {multicmd-1.69 → multicmd-1.70}/tests/test_terminal_width.py +86 -6
- {multicmd-1.69 → multicmd-1.70}/LICENSE +0 -0
- {multicmd-1.69 → multicmd-1.70}/multiCMD.egg-info/SOURCES.txt +0 -0
- {multicmd-1.69 → multicmd-1.70}/multiCMD.egg-info/dependency_links.txt +0 -0
- {multicmd-1.69 → multicmd-1.70}/multiCMD.egg-info/entry_points.txt +0 -0
- {multicmd-1.69 → multicmd-1.70}/multiCMD.egg-info/top_level.txt +0 -0
- {multicmd-1.69 → multicmd-1.70}/scripts/multiCMD +0 -0
- {multicmd-1.69 → multicmd-1.70}/setup.cfg +0 -0
- {multicmd-1.69 → multicmd-1.70}/setup.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_api.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_async_executor.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_cli.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_cli_closed_stdout.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_cli_failed_stdout.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_cli_input.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_cli_summary.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_display.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_embed.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_env.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_expand_ranges.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_handover.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_helpers.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_interrupts.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_packaging.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_parsing.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_pass_fds.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_ping.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_pool.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_process_groups.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_pty.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_reader.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_reader_quit.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_regressions.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_run_command.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_run_commands.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_sudo.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_supervision.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_task.py +0 -0
- {multicmd-1.69 → multicmd-1.70}/tests/test_windows.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: multiCMD
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.70
|
|
4
4
|
Summary: Run commands simultaneously
|
|
5
5
|
Home-page: https://github.com/yufei-pan/multiCMD
|
|
6
6
|
Author: Yufei Pan
|
|
@@ -539,6 +539,8 @@ The module also bundles a few terminal/formatting helpers used internally and
|
|
|
539
539
|
reusable on their own: `pretty_format_table`, `parseTable`, `print_progress_bar`,
|
|
540
540
|
`format_bytes`, `get_terminal_size`, `input_with_timeout_and_countdown` (its prompt and countdown go to
|
|
541
541
|
stderr), and `slugify`.
|
|
542
|
+
A progress bar counts its blocks as one column each, so a terminal set to draw East Asian ambiguous-width
|
|
543
|
+
characters wide wraps it ([docs/limitations.md](docs/limitations.md)).
|
|
542
544
|
|
|
543
545
|
## Platform support
|
|
544
546
|
|
|
@@ -558,14 +560,29 @@ pytest -m "not slow" # skip intentional sleep-heavy cases
|
|
|
558
560
|
|
|
559
561
|
`test_expand_ranges_perf.py` is a manual performance microbenchmark and is not collected by pytest.
|
|
560
562
|
|
|
563
|
+
## Upgrading to 1.70 from 1.69
|
|
564
|
+
|
|
565
|
+
- Nothing needs doing. `mcmd` is unchanged.
|
|
566
|
+
- Changed, library: beside a `print_progress_bar()` bar of 10 cells, the prefix gives way from its end down to its first `|`
|
|
567
|
+
followed by a blank before the percent goes, and what followed that `|` stays gone once the percent has gone (1.69
|
|
568
|
+
dropped the percent first). At 132 columns hpcp's copy bar shows `16 Scheduled` and its percent where 1.69 showed
|
|
569
|
+
`16 Scheduled 4.0 F/Job` and no percent (with typical strings). A prefix with no such `|` before its end gives way in
|
|
570
|
+
1.69's order, with the room of the widest percent (the next point).
|
|
571
|
+
- Changed, library: what a bar keeps of its prefix and suffix, and whether it has a percent, hold as its percent grows, up
|
|
572
|
+
to 999.9% (a wider one decides for itself; the bar's own length follows each frame's percent). The layout is decided with
|
|
573
|
+
the widest percent (`|100.0% `, 8 cells; the frame's own is 6 at 0.1% to 9.9% and 7 to 99.9%), so the frame left on the
|
|
574
|
+
screen at the total keeps what the frames before it showed: 1.69 showed hpcp's copy bar's percent at 99.9% and none at
|
|
575
|
+
the total at 135 columns. The percent starts at 110 columns (the rate-limited line: 118).
|
|
576
|
+
|
|
561
577
|
## Upgrading to 1.69 from 1.68
|
|
562
578
|
|
|
563
579
|
- Nothing needs doing. `mcmd` is unchanged.
|
|
564
580
|
- Changed, library: a `print_progress_bar()` frame with a total keeps a bar of at least 10 cells (from 12 columns up; the first
|
|
565
581
|
frame holds ` Calculating... ` or blanks in its place). Beside it the percent
|
|
566
|
-
gives way first, then the prefix from its end down to its first field, then the suffix from its start
|
|
567
|
-
|
|
568
|
-
the percent and the prefix whole). At 80 columns hpcp's copy bar shows its
|
|
582
|
+
gives way first, then the prefix from its end down to its first field, then the suffix from its start (a first field
|
|
583
|
+
wider than the room goes before it), a whole field at a time, so a number keeps its unit and its label
|
|
584
|
+
(1.68 shrank the bar to two cells, then dropped the percent and the prefix whole). At 80 columns hpcp's copy bar shows its
|
|
585
|
+
count and its time left (1.68: no count).
|
|
569
586
|
- Fix, library: the first frame at or past the total ends its line, so the program's next output does not join a count
|
|
570
587
|
that stepped over its total (1.68 ended the line only at a frame equal to the total). A count that goes on past its
|
|
571
588
|
total draws its later frames on the next line, and the last stays open: the next output joins it.
|
|
@@ -514,6 +514,8 @@ The module also bundles a few terminal/formatting helpers used internally and
|
|
|
514
514
|
reusable on their own: `pretty_format_table`, `parseTable`, `print_progress_bar`,
|
|
515
515
|
`format_bytes`, `get_terminal_size`, `input_with_timeout_and_countdown` (its prompt and countdown go to
|
|
516
516
|
stderr), and `slugify`.
|
|
517
|
+
A progress bar counts its blocks as one column each, so a terminal set to draw East Asian ambiguous-width
|
|
518
|
+
characters wide wraps it ([docs/limitations.md](docs/limitations.md)).
|
|
517
519
|
|
|
518
520
|
## Platform support
|
|
519
521
|
|
|
@@ -533,14 +535,29 @@ pytest -m "not slow" # skip intentional sleep-heavy cases
|
|
|
533
535
|
|
|
534
536
|
`test_expand_ranges_perf.py` is a manual performance microbenchmark and is not collected by pytest.
|
|
535
537
|
|
|
538
|
+
## Upgrading to 1.70 from 1.69
|
|
539
|
+
|
|
540
|
+
- Nothing needs doing. `mcmd` is unchanged.
|
|
541
|
+
- Changed, library: beside a `print_progress_bar()` bar of 10 cells, the prefix gives way from its end down to its first `|`
|
|
542
|
+
followed by a blank before the percent goes, and what followed that `|` stays gone once the percent has gone (1.69
|
|
543
|
+
dropped the percent first). At 132 columns hpcp's copy bar shows `16 Scheduled` and its percent where 1.69 showed
|
|
544
|
+
`16 Scheduled 4.0 F/Job` and no percent (with typical strings). A prefix with no such `|` before its end gives way in
|
|
545
|
+
1.69's order, with the room of the widest percent (the next point).
|
|
546
|
+
- Changed, library: what a bar keeps of its prefix and suffix, and whether it has a percent, hold as its percent grows, up
|
|
547
|
+
to 999.9% (a wider one decides for itself; the bar's own length follows each frame's percent). The layout is decided with
|
|
548
|
+
the widest percent (`|100.0% `, 8 cells; the frame's own is 6 at 0.1% to 9.9% and 7 to 99.9%), so the frame left on the
|
|
549
|
+
screen at the total keeps what the frames before it showed: 1.69 showed hpcp's copy bar's percent at 99.9% and none at
|
|
550
|
+
the total at 135 columns. The percent starts at 110 columns (the rate-limited line: 118).
|
|
551
|
+
|
|
536
552
|
## Upgrading to 1.69 from 1.68
|
|
537
553
|
|
|
538
554
|
- Nothing needs doing. `mcmd` is unchanged.
|
|
539
555
|
- Changed, library: a `print_progress_bar()` frame with a total keeps a bar of at least 10 cells (from 12 columns up; the first
|
|
540
556
|
frame holds ` Calculating... ` or blanks in its place). Beside it the percent
|
|
541
|
-
gives way first, then the prefix from its end down to its first field, then the suffix from its start
|
|
542
|
-
|
|
543
|
-
the percent and the prefix whole). At 80 columns hpcp's copy bar shows its
|
|
557
|
+
gives way first, then the prefix from its end down to its first field, then the suffix from its start (a first field
|
|
558
|
+
wider than the room goes before it), a whole field at a time, so a number keeps its unit and its label
|
|
559
|
+
(1.68 shrank the bar to two cells, then dropped the percent and the prefix whole). At 80 columns hpcp's copy bar shows its
|
|
560
|
+
count and its time left (1.68: no count).
|
|
544
561
|
- Fix, library: the first frame at or past the total ends its line, so the program's next output does not join a count
|
|
545
562
|
that stepped over its total (1.68 ended the line only at a frame equal to the total). A count that goes on past its
|
|
546
563
|
total draws its later frames on the next line, and the last stays open: the next output joins it.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: multiCMD
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.70
|
|
4
4
|
Summary: Run commands simultaneously
|
|
5
5
|
Home-page: https://github.com/yufei-pan/multiCMD
|
|
6
6
|
Author: Yufei Pan
|
|
@@ -539,6 +539,8 @@ The module also bundles a few terminal/formatting helpers used internally and
|
|
|
539
539
|
reusable on their own: `pretty_format_table`, `parseTable`, `print_progress_bar`,
|
|
540
540
|
`format_bytes`, `get_terminal_size`, `input_with_timeout_and_countdown` (its prompt and countdown go to
|
|
541
541
|
stderr), and `slugify`.
|
|
542
|
+
A progress bar counts its blocks as one column each, so a terminal set to draw East Asian ambiguous-width
|
|
543
|
+
characters wide wraps it ([docs/limitations.md](docs/limitations.md)).
|
|
542
544
|
|
|
543
545
|
## Platform support
|
|
544
546
|
|
|
@@ -558,14 +560,29 @@ pytest -m "not slow" # skip intentional sleep-heavy cases
|
|
|
558
560
|
|
|
559
561
|
`test_expand_ranges_perf.py` is a manual performance microbenchmark and is not collected by pytest.
|
|
560
562
|
|
|
563
|
+
## Upgrading to 1.70 from 1.69
|
|
564
|
+
|
|
565
|
+
- Nothing needs doing. `mcmd` is unchanged.
|
|
566
|
+
- Changed, library: beside a `print_progress_bar()` bar of 10 cells, the prefix gives way from its end down to its first `|`
|
|
567
|
+
followed by a blank before the percent goes, and what followed that `|` stays gone once the percent has gone (1.69
|
|
568
|
+
dropped the percent first). At 132 columns hpcp's copy bar shows `16 Scheduled` and its percent where 1.69 showed
|
|
569
|
+
`16 Scheduled 4.0 F/Job` and no percent (with typical strings). A prefix with no such `|` before its end gives way in
|
|
570
|
+
1.69's order, with the room of the widest percent (the next point).
|
|
571
|
+
- Changed, library: what a bar keeps of its prefix and suffix, and whether it has a percent, hold as its percent grows, up
|
|
572
|
+
to 999.9% (a wider one decides for itself; the bar's own length follows each frame's percent). The layout is decided with
|
|
573
|
+
the widest percent (`|100.0% `, 8 cells; the frame's own is 6 at 0.1% to 9.9% and 7 to 99.9%), so the frame left on the
|
|
574
|
+
screen at the total keeps what the frames before it showed: 1.69 showed hpcp's copy bar's percent at 99.9% and none at
|
|
575
|
+
the total at 135 columns. The percent starts at 110 columns (the rate-limited line: 118).
|
|
576
|
+
|
|
561
577
|
## Upgrading to 1.69 from 1.68
|
|
562
578
|
|
|
563
579
|
- Nothing needs doing. `mcmd` is unchanged.
|
|
564
580
|
- Changed, library: a `print_progress_bar()` frame with a total keeps a bar of at least 10 cells (from 12 columns up; the first
|
|
565
581
|
frame holds ` Calculating... ` or blanks in its place). Beside it the percent
|
|
566
|
-
gives way first, then the prefix from its end down to its first field, then the suffix from its start
|
|
567
|
-
|
|
568
|
-
the percent and the prefix whole). At 80 columns hpcp's copy bar shows its
|
|
582
|
+
gives way first, then the prefix from its end down to its first field, then the suffix from its start (a first field
|
|
583
|
+
wider than the room goes before it), a whole field at a time, so a number keeps its unit and its label
|
|
584
|
+
(1.68 shrank the bar to two cells, then dropped the percent and the prefix whole). At 80 columns hpcp's copy bar shows its
|
|
585
|
+
count and its time left (1.68: no count).
|
|
569
586
|
- Fix, library: the first frame at or past the total ends its line, so the program's next output does not join a count
|
|
570
587
|
that stepped over its total (1.68 ended the line only at a frame equal to the total). A count that goes on past its
|
|
571
588
|
total draws its later frames on the next line, and the last stays open: the next output joins it.
|
|
@@ -29,9 +29,9 @@ import traceback
|
|
|
29
29
|
from pprint import pformat
|
|
30
30
|
|
|
31
31
|
#%% global vars
|
|
32
|
-
version = '1.
|
|
32
|
+
version = '1.70'
|
|
33
33
|
__version__ = version
|
|
34
|
-
COMMIT_DATE = '2026-11-
|
|
34
|
+
COMMIT_DATE = '2026-11-23'
|
|
35
35
|
# fire-and-forget threads (run_commands with wait_for_return=False) that join_threads() waits on. multiCMD takes no
|
|
36
36
|
# lock for it: each update is one set operation and each snapshot one set.copy(), as for _live_procs below
|
|
37
37
|
__running_threads = set()
|
|
@@ -3641,6 +3641,18 @@ def _first_field(prefix):
|
|
|
3641
3641
|
return kept + ' |'
|
|
3642
3642
|
return ''
|
|
3643
3643
|
|
|
3644
|
+
def _first_part(prefix):
|
|
3645
|
+
'''
|
|
3646
|
+
A frame's prefix cut after its first '|' that ends a field ( internal; see _cut_prefix ), else whole: what follows it gives
|
|
3647
|
+
way before the percent ( hpcp's jobs, after its count, size and word )
|
|
3648
|
+
'''
|
|
3649
|
+
for i in range(1, len(prefix)):
|
|
3650
|
+
if prefix[i] == ' ' and prefix[i - 1] == '|':
|
|
3651
|
+
kept = prefix[:i].rstrip(' |')
|
|
3652
|
+
if kept:
|
|
3653
|
+
return kept + ' |'
|
|
3654
|
+
return prefix
|
|
3655
|
+
|
|
3644
3656
|
def _cut_suffix(suffix, width):
|
|
3645
3657
|
'''
|
|
3646
3658
|
A frame's suffix in width terminal columns ( internal ): whole, or its end, joined to the bar by '| ' again, from a blank it
|
|
@@ -3685,18 +3697,28 @@ def _genrate_progress_bar(iteration, total, prefix='', suffix='',columns=240):
|
|
|
3685
3697
|
return line + ' ' * (width - _cells(line))
|
|
3686
3698
|
percent = f'|{("{0:.1f}").format(100 * (iteration / float(total)))}% '
|
|
3687
3699
|
# a bar is length + 1 wide, full or not ( see below ), so a frame is at most columns - 2 wide. Beside a bar of _LEAST_BAR
|
|
3688
|
-
# cells, what does not fit gives way from the bar outward
|
|
3689
|
-
#
|
|
3690
|
-
#
|
|
3700
|
+
# cells, what does not fit gives way from the bar outward, a whole field at a time: the prefix from its end down to its first
|
|
3701
|
+
# '|' that ends a field ( hpcp's jobs ), the percent, the prefix on down to its first field, the suffix from its start, then
|
|
3702
|
+
# that field ( a first field wider than the room goes before the suffix is cut ). The line keeps what it starts and ends with
|
|
3703
|
+
# longest: hpcp's count, and its time left ( 1.69 dropped the percent first: hpcp's copy bar at 127 to 134 columns showed its
|
|
3704
|
+
# jobs and no percent, where 1.68 showed both ). The choice is made with the widest percent, '|100.0% ' ( 6 cells at 0.1%, 7 at
|
|
3705
|
+
# 10.0%, 8 at 100.0% to 999.9% ), so the prefix and the suffix a frame keeps, and whether it has a percent, do not change as
|
|
3706
|
+
# the percent grows: the frame left on the screen, at the total, keeps what the frames before it showed. A percent wider than
|
|
3707
|
+
# that ( a total that was off tenfold ) decides for itself
|
|
3691
3708
|
room = columns - 2 - _LEAST_BAR
|
|
3692
3709
|
prefix_cells, suffix_cells = _cells(prefix), _cells(suffix)
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3710
|
+
reserve = max(len(percent), len('|100.0% '))
|
|
3711
|
+
if prefix_cells + suffix_cells + reserve > room:
|
|
3712
|
+
# the prefix down to its first part, kept whole until the percent has gone; what followed it does not come back then
|
|
3713
|
+
cut, first = _cut_prefix(prefix, room - suffix_cells - reserve), _first_part(prefix)
|
|
3714
|
+
prefix = cut if _cells(cut) > _cells(first) else first
|
|
3715
|
+
if _cells(prefix) + suffix_cells + reserve > room:
|
|
3716
|
+
percent = ''
|
|
3717
|
+
if _cells(prefix) + suffix_cells > room:
|
|
3718
|
+
prefix = _cut_prefix(prefix, room - suffix_cells) or _first_field(prefix)
|
|
3719
|
+
if _cells(prefix) > room:
|
|
3720
|
+
prefix = ''
|
|
3721
|
+
suffix = _cut_suffix(suffix, room - _cells(prefix))
|
|
3700
3722
|
length = columns - _cells(prefix) - _cells(suffix) - len(percent) - 3
|
|
3701
3723
|
if length <= 0:
|
|
3702
3724
|
# 3 columns or fewer: no room for a bar
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'''A progress line fits its terminal (1.68): a terminal of no size counts as unknown, and a frame is cut to one column less
|
|
2
2
|
than the width, in terminal columns. A bar with a total keeps 10 cells, and its text gives way a field at a time; a bar past
|
|
3
|
-
its total ends its line; a control character in a frame's text is a '?' (1.69).'''
|
|
3
|
+
its total ends its line; a control character in a frame's text is a '?' (1.69). What follows a frame's prefix's first '|'
|
|
4
|
+
gives way before the percent, and the prefix and suffix a bar keeps hold as its percent grows (1.70).'''
|
|
4
5
|
import os
|
|
5
6
|
import re
|
|
6
7
|
import select
|
|
@@ -433,17 +434,96 @@ def a_broken_start(kept, whole):
|
|
|
433
434
|
(80, COPY_LIMITED, ('123.46 KF |', 10, '| 2.35 KF/s | 1.00 GiB/s Limit | 5.00 KF/s Limit | 1h2m3s')),
|
|
434
435
|
(100, COPY, ('123.46 KF (45.60 GiB) |', 15, '| ' + COPY)),
|
|
435
436
|
(100, COPY_LIMITED, ('123.46 KF |', 19, '| ' + COPY_LIMITED)),
|
|
436
|
-
# 1.68: the whole prefix and a bar of 2 cells
|
|
437
|
-
(120, COPY, ('123.46 KF (45.60 GiB) Copied |
|
|
437
|
+
# 1.68: the whole prefix and a bar of 2 cells; 1.69: its jobs' count ( '16 Scheduled' ) and no percent
|
|
438
|
+
(120, COPY, ('123.46 KF (45.60 GiB) Copied |', 21, '|50.0% | ' + COPY)),
|
|
439
|
+
# 1.68: all of it beside a bar of 2 to 9 cells; 1.69: all of its jobs and no percent. 1.70 decides with the percent at the
|
|
440
|
+
# total ( '|100.0% ', one cell wider than '|50.0% ' ), so a bar's prefix and suffix hold from its first frame to its
|
|
441
|
+
# last: all of its jobs and the percent from 135 columns ( 1.68: from 127, beside a bar of 2 to 9 cells; 1.69: the
|
|
442
|
+
# percent from 135 )
|
|
443
|
+
(127, COPY, ('123.46 KF (45.60 GiB) Copied | 16 Scheduled |', 13, '|50.0% | ' + COPY)),
|
|
444
|
+
(134, COPY, ('123.46 KF (45.60 GiB) Copied | 16 Scheduled |', 20, '|50.0% | ' + COPY)),
|
|
445
|
+
(135, COPY, ('123.46 KF (45.60 GiB) Copied | 16 Scheduled 4.0 F/Job |', 11, '|50.0% | ' + COPY)),
|
|
446
|
+
(135, COPY_LIMITED, ('123.46 KF (45.60 GiB) Copied | 16 Scheduled |', 13, '|50.0% | ' + COPY_LIMITED)),
|
|
447
|
+
(143, COPY_LIMITED, ('123.46 KF (45.60 GiB) Copied | 16 Scheduled 4.0 F/Job |', 11, '|50.0% | ' + COPY_LIMITED)),
|
|
438
448
|
(160, COPY, (COPY_PREFIX + ' |', 35, '|50.0% | ' + COPY)),
|
|
439
|
-
], ids=['80', '80-limited', '100', '100-limited', '120', '160'])
|
|
449
|
+
], ids=['80', '80-limited', '100', '100-limited', '120', '127', '134', '135', '135-limited', '143-limited', '160'])
|
|
440
450
|
def test_hpcp_copy_bar_keeps_its_count_and_its_time_left(columns, suffix, shown):
|
|
441
|
-
# the bar keeps 10 cells; beside it the
|
|
442
|
-
# from its start: the line keeps what it starts and ends with ( the count, the
|
|
451
|
+
# the bar keeps 10 cells; beside it the prefix's jobs give way ( what follows its first '|' ), then the percent, then the
|
|
452
|
+
# prefix on down to its count, then the suffix from its start: the line keeps what it starts and ends with ( the count, the
|
|
453
|
+
# time left )
|
|
443
454
|
frame = _genrate_progress_bar(5, 10, COPY_PREFIX + ' |', '| ' + suffix, columns)
|
|
444
455
|
assert parts(frame) == shown and cells(frame) == columns - 2, frame
|
|
445
456
|
|
|
446
457
|
|
|
458
|
+
# a stage of three after the count: a part after the first '|' that is narrower than the percent
|
|
459
|
+
STAGE_PREFIX = f'{fb(1234)}F Copied | 2/3'
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
@pytest.mark.parametrize('suffix', [COPY, COPY_LIMITED], ids=['copy', 'copy-limited'])
|
|
463
|
+
@pytest.mark.parametrize('prefix', [COPY_PREFIX, COPY_PREFIX.replace(' Copied ', ' Deleted '), STAGE_PREFIX],
|
|
464
|
+
ids=['copy', 'deleted', 'stage'])
|
|
465
|
+
def test_the_percent_outlasts_what_follows_the_prefixs_first_bar(prefix, suffix):
|
|
466
|
+
# 1.69 dropped the percent first: hpcp's copy bar at 127 to 134 columns showed its jobs and no percent ( 1.68 showed both,
|
|
467
|
+
# beside a bar of 2 to 9 cells ). What follows the prefix's first '|' gives way first, from its end, then the percent, and
|
|
468
|
+
# it does not come back once the percent has gone ( a part narrower than the percent would fit in its place )
|
|
469
|
+
first = prefix[:prefix.index(' | ')] + ' |'
|
|
470
|
+
prefix, suffix = prefix + ' |', '| ' + suffix
|
|
471
|
+
for columns in range(12, 201):
|
|
472
|
+
frame = _genrate_progress_bar(5, 10, prefix, suffix, columns)
|
|
473
|
+
head, bar, tail = parts(frame)
|
|
474
|
+
percent = tail.startswith('|50.0% ')
|
|
475
|
+
assert bar >= 10 and cells(frame) == columns - 2, (columns, frame)
|
|
476
|
+
if cells(head) > cells(first):
|
|
477
|
+
assert percent, (columns, frame)
|
|
478
|
+
# the percent that must fit is the widest, the one at the total ( see the test below )
|
|
479
|
+
if cells(first) + cells('|100.0% ') + cells(suffix) + 10 <= columns - 2:
|
|
480
|
+
assert percent and head.startswith(first), (columns, frame)
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
def test_a_prefix_with_no_bar_inside_gives_way_after_the_percent():
|
|
484
|
+
# as in 1.69: hpcp's symbolic link bar is one part, so at 55 columns its percent goes and its prefix stays whole
|
|
485
|
+
frame = _genrate_progress_bar(5, 10, '1234 Symbolic Links Created |', '| 5678.12 F/s', 55)
|
|
486
|
+
assert parts(frame) == ('1234 Symbolic Links Created |', 11, '| 5678.12 F/s'), frame
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
def test_a_bar_inside_a_word_is_not_the_prefixs_first_bar():
|
|
490
|
+
# a '|' with no blank after it ( a name's 'a|b' ) ends no part: the prefix gives way as one part, after the percent
|
|
491
|
+
frame = _genrate_progress_bar(5, 10, 'a|b 1234 Links Created |', '| 5678.12 F/s', 50)
|
|
492
|
+
assert parts(frame) == ('a|b 1234 Links Created |', 11, '| 5678.12 F/s'), frame
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
@pytest.mark.parametrize('prefix, suffix', [
|
|
496
|
+
(COPY_PREFIX, COPY), (COPY_PREFIX, COPY_LIMITED),
|
|
497
|
+
(COPY_PREFIX.replace(' Copied ', ' Deleted '), COPY), (COPY_PREFIX.replace(' Copied ', ' Deleted '), COPY_LIMITED),
|
|
498
|
+
(STAGE_PREFIX, COPY), ('1234 Symbolic Links Created', '5678.12 F/s'), (PATH[-50:], REMOVAL),
|
|
499
|
+
], ids=['copy', 'copy-limited', 'deleted', 'deleted-limited', 'stage', 'symlinks', 'path'])
|
|
500
|
+
def test_a_bars_parts_do_not_change_as_its_percent_grows(prefix, suffix):
|
|
501
|
+
# the percent is 6 cells at 0.1% to 9.9%, 7 at 10.0% to 99.9% and 8 at 100.0% to 999.9% ( '|100.0% ' ). A layout decided with
|
|
502
|
+
# the frame's own percent drew hpcp's copy bar with its percent at 99.9% and none at the total, the frame left on the screen
|
|
503
|
+
# ( with this file's strings: 1.69 at 135 columns; 1.70's first build at 109, and its jobs at 124 and 134 ). The prefix, the
|
|
504
|
+
# suffix and whether the percent shows hold from the first frame ( which has no percent ) to the last; the bar's length
|
|
505
|
+
# follows each frame's percent
|
|
506
|
+
prefix, suffix = prefix + ' |', '| ' + suffix
|
|
507
|
+
for columns in range(12, 201):
|
|
508
|
+
seen = set()
|
|
509
|
+
for iteration in (1, 50, 99, 100, 500, 999, 1000, 1100, 9999):
|
|
510
|
+
head, bar, tail = parts(_genrate_progress_bar(iteration, 1000, prefix, suffix, columns))
|
|
511
|
+
percent = re.match(r'\|\d+\.\d% ', tail)
|
|
512
|
+
seen.add((head, bool(percent), tail[percent.end():] if percent else tail))
|
|
513
|
+
assert bar >= 10, (columns, iteration, bar)
|
|
514
|
+
assert len(seen) == 1, (columns, seen)
|
|
515
|
+
(head, _, rest), = seen
|
|
516
|
+
first = _genrate_progress_bar(0, 1000, prefix, suffix, columns)
|
|
517
|
+
assert first.startswith(head) and first.endswith(rest), (columns, first)
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
def test_a_percent_wider_than_the_one_at_the_total_keeps_a_bar_of_10_cells():
|
|
521
|
+
# a count tenfold over its total ( '|1000.0% ', 9 cells ) decides with its own percent: the bar keeps its 10 cells
|
|
522
|
+
for columns in range(12, 201):
|
|
523
|
+
frame = _genrate_progress_bar(10000, 1000, COPY_PREFIX + ' |', '| ' + COPY, columns)
|
|
524
|
+
assert parts(frame)[1] >= 10 and cells(frame) == columns - 2, (columns, frame)
|
|
525
|
+
|
|
526
|
+
|
|
447
527
|
@pytest.mark.parametrize('suffix', [COPY, COPY_LIMITED, REMOVAL], ids=['copy', 'copy-limited', 'removal'])
|
|
448
528
|
@pytest.mark.parametrize('prefix', [COPY_PREFIX, PATH[-50:], WIDE_PATH[-50:]], ids=['copy', 'path', 'wide-path'])
|
|
449
529
|
def test_a_frame_of_a_known_total_keeps_whole_fields_beside_10_cells_at_any_width(prefix, suffix):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|