forked from pre-commit/pre-commit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers_test.py
More file actions
30 lines (20 loc) · 789 Bytes
/
helpers_test.py
File metadata and controls
30 lines (20 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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():
assert helpers.basic_get_default_version() == 'default'
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))