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

tests/test_cmdline.py::CmdLineStdoutTest::test_cmd_help fails on large terminals #1013

Merged
merged 1 commit into from Jul 19, 2020
Merged

Conversation

ghost
Copy link

@ghost ghost commented Jul 19, 2020

The test CmdLineStdoutTest::test_cmd_help in tests/test_cmdline.py checks for a certain number of lines in the output.
However, optparse formats the output according to the terminals column count (often given by the environment variable COLUMNS; if detection fails, 80 is used).
The smaller the terminal the more line breaks occur.

The current test tests against at least 30 lines. Which is fulfilled on smallish terminals (e.g. 80 columns).
However, on larger terminals (e.g. 200 columns) every option description fits into one line reducing the count to 23 and the test fails.

This pull request changes the test to test against 20 lines (to have some leeway) to also support large terminals.

The number of lines in the help output of a command depends on the terminal.

An alternative way would be to always run the test suite with COLUMNS=80 set as environment variable.
However, this puts the burden onto the user which have to ensure to have the "correct" environment.

The number of lines in the help output of a command depends on the terminal
size. The smaller the more line breaks.

The minimum number of lines for the current help message is 23. Currently we
are checking for at least 30 lines, yielding to failures on large terminals.

Reduce the number (currently 30) to 20 to have some leeway for the future.
@nedbat nedbat merged commit db4213b into nedbat:master Jul 19, 2020
@nedbat
Copy link
Owner

nedbat commented Jul 19, 2020

Thanks!

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.

None yet

1 participant