mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Merge pull request #168 from pre-commit/fix_width_thingy
Fix terminal width detection.
This commit is contained in:
commit
5a7a487b7d
3 changed files with 6 additions and 4 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
- id: autopep8-wrapper
|
- id: autopep8-wrapper
|
||||||
args: ['-i', '--ignore=E265,E309,E501', '-v']
|
args: ['-i', '--ignore=E265,E309,E501']
|
||||||
- id: check-json
|
- id: check-json
|
||||||
- id: check-yaml
|
- id: check-yaml
|
||||||
- id: debug-statements
|
- id: debug-statements
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
@ -11,7 +10,7 @@ from pre_commit import five
|
||||||
# TODO: smell: import side-effects
|
# TODO: smell: import side-effects
|
||||||
COLS = int(
|
COLS = int(
|
||||||
subprocess.Popen(
|
subprocess.Popen(
|
||||||
['tput', 'cols'], stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'),
|
['tput', 'cols'], stdout=subprocess.PIPE,
|
||||||
).communicate()[0] or
|
).communicate()[0] or
|
||||||
# Default in the case of no terminal
|
# Default in the case of no terminal
|
||||||
80
|
80
|
||||||
|
|
|
||||||
|
|
@ -382,7 +382,10 @@ def test_installed_from_venv(tmpdir_factory):
|
||||||
# Should still pick up the python from when we installed
|
# Should still pick up the python from when we installed
|
||||||
ret, output = _get_commit_output(
|
ret, output = _get_commit_output(
|
||||||
tmpdir_factory,
|
tmpdir_factory,
|
||||||
env_base={'HOME': os.environ['HOME']},
|
env_base={
|
||||||
|
'HOME': os.environ['HOME'],
|
||||||
|
'TERM': os.environ.get('TERM', ''),
|
||||||
|
},
|
||||||
)
|
)
|
||||||
assert ret == 0
|
assert ret == 0
|
||||||
assert NORMAL_PRE_COMMIT_RUN.match(output)
|
assert NORMAL_PRE_COMMIT_RUN.match(output)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue