Fix test since pip 10 changed output

This commit is contained in:
Anthony Sottile 2018-05-21 21:38:36 -07:00
parent 3555a2b158
commit f88e007f52
4 changed files with 18 additions and 48 deletions

View file

@ -1,7 +1,13 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import sys
import pytest
from pre_commit.languages import helpers
from pre_commit.prefix import Prefix
from pre_commit.util import CalledProcessError
def test_basic_get_default_version():
@ -10,3 +16,15 @@ def test_basic_get_default_version():
def test_basic_healthy():
assert helpers.basic_healthy(None, None) is True
def test_failed_setup_command_does_not_unicode_error():
script = (
'import sys\n'
"getattr(sys.stderr, 'buffer', sys.stderr).write(b'\\x81\\xfe')\n"
'exit(1)\n'
)
# an assertion that this does not raise `UnicodeError`
with pytest.raises(CalledProcessError):
helpers.run_setup_cmd(Prefix('.'), (sys.executable, '-c', script))