Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiProgressBar fixes and tests #1925

Merged
merged 8 commits into from
Dec 5, 2024

Conversation

kontura
Copy link
Contributor

@kontura kontura commented Dec 4, 2024

Fix couple of issues for MultiProgressBar printing.

Add testing for MultiProgressBar in interactive mode.

Since now every finished progressbar ends with a new line and in non
interactive mode only finished progressbars are printed this additional
print should never be needed.
Previously the new line was always printed resulting in excessive empty
line which was visible for example during the downloading packages phase
of an update:
```
[  1/109] kernel-modules-0:6.13.0-0.rc1.20241202gite70140ba0d2b.14.fc42.x86_64                                                                         7% [=                 ] | 781.3 KiB/s |   4.9 MiB | -01m18s
[  2/109] kernel-core-0:6.13.0-0.rc1.20241202gite70140ba0d2b.14.fc42.x86_64                                                                            8% [==                ] | 381.1 KiB/s |   1.5 MiB | -00m45s
[  3/109] kernel-modules-core-0:6.13.0-0.rc1.20241202gite70140ba0d2b.14.fc42.x86_64                                                                    3% [=                 ] | 355.8 KiB/s |   1.2 MiB | -01m47s
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[  0/109] Total                                                                                                                                        3% [=                 ] |   1.5 MiB/s |   7.6 MiB | -02m05s

```
(last line is empty)

This was introduced recently in PR rpm-software-management#1805
Since PR rpm-software-management#1825
we are overwriting old output instead of specifically clearing it.
This causes problems when messages are removed from progressbars like it
happens when scriptlets finish successfully without any logs.

Closes: rpm-software-management#1899

Also adds couple describing comments.
This is similar to the `FORCE_COLUMNS` override.
Ensure the tests run in non interactive mode and force columns to 70.
It also uses new `ASSERT_MATCH` macro.

This simplifies the tests.

In addition one test is extended and one new test is added.
In order to be able to compare the outputs it implements
`perform_control_sequences` function which simulates a terminal
emulator. Since this is a bit complicated there are also specific tests
for this testing function.
Copy link
Member

@evan-goode evan-goode left a comment

Choose a reason for hiding this comment

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

I verified that this fixes #1899.

Copy link
Member

@m-blaha m-blaha left a comment

Choose a reason for hiding this comment

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

Thanks for adding the tests and explanatory comments!

@m-blaha m-blaha added this pull request to the merge queue Dec 5, 2024
Merged via the queue into rpm-software-management:main with commit 38e5c7e Dec 5, 2024
15 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants