Merge pull request #408 from pre-commit/no_pyterminalsize

Use 80 or min width instead of terminal size
This commit is contained in:
Anthony Sottile 2016-10-23 16:48:53 -07:00 committed by GitHub
commit e832ddc57f
4 changed files with 63 additions and 31 deletions

View file

@ -13,6 +13,7 @@ import pytest
import pre_commit.constants as C
from pre_commit.commands.install_uninstall import install
from pre_commit.commands.run import _compute_cols
from pre_commit.commands.run import _get_skips
from pre_commit.commands.run import _has_unmerged_paths
from pre_commit.commands.run import get_changed_files
@ -279,6 +280,23 @@ def test_merge_conflict_resolved(in_merge_conflict, mock_out_store_directory):
assert msg in printed
@pytest.mark.parametrize(
('hooks', 'verbose', 'expected'),
(
([], True, 80),
([{'id': 'a', 'name': 'a' * 51}], False, 81),
([{'id': 'a', 'name': 'a' * 51}], True, 85),
(
[{'id': 'a', 'name': 'a' * 51}, {'id': 'b', 'name': 'b' * 52}],
False,
82,
),
),
)
def test_compute_cols(hooks, verbose, expected):
assert _compute_cols(hooks, verbose) == expected
@pytest.mark.parametrize(
('environ', 'expected_output'),
(