tests/test_cmdline.py::CmdLineStdoutTest::test_cmd_help fails on large terminals #1013
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The test
CmdLineStdoutTest::test_cmd_help
intests/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.