Remove pre_commit.five

This commit is contained in:
Anthony Sottile 2020-01-12 11:44:41 -08:00
parent f33716cc17
commit 67c2dcd90d
10 changed files with 33 additions and 60 deletions

View file

@ -256,10 +256,9 @@ class Fixture:
def cap_out():
stream = FakeStream()
write = functools.partial(output.write, stream=stream)
write_line = functools.partial(output.write_line, stream=stream)
with mock.patch.object(output, 'write', write):
with mock.patch.object(output, 'write_line', write_line):
yield Fixture(stream)
write_line_b = functools.partial(output.write_line_b, stream=stream)
with mock.patch.multiple(output, write=write, write_line_b=write_line_b):
yield Fixture(stream)
@pytest.fixture

View file

@ -10,7 +10,6 @@ import cfgv
import pytest
import pre_commit.constants as C
from pre_commit import five
from pre_commit.clientlib import CONFIG_SCHEMA
from pre_commit.clientlib import load_manifest
from pre_commit.envcontext import envcontext
@ -119,7 +118,7 @@ def test_python_hook(tempdir_factory, store):
_test_hook_repo(
tempdir_factory, store, 'python_hooks_repo',
'foo', [os.devnull],
b"['" + five.to_bytes(os.devnull) + b"']\nHello World\n",
f'[{os.devnull!r}]\nHello World\n'.encode(),
)
@ -154,7 +153,7 @@ def test_python_hook_weird_setup_cfg(in_git_dir, tempdir_factory, store):
_test_hook_repo(
tempdir_factory, store, 'python_hooks_repo',
'foo', [os.devnull],
b"['" + five.to_bytes(os.devnull) + b"']\nHello World\n",
f'[{os.devnull!r}]\nHello World\n'.encode(),
)
@ -163,7 +162,7 @@ def test_python_venv(tempdir_factory, store): # pragma: no cover (no venv)
_test_hook_repo(
tempdir_factory, store, 'python_venv_hooks_repo',
'foo', [os.devnull],
b"['" + five.to_bytes(os.devnull) + b"']\nHello World\n",
f'[{os.devnull!r}]\nHello World\n'.encode(),
)
@ -188,7 +187,7 @@ def test_versioned_python_hook(tempdir_factory, store):
tempdir_factory, store, 'python3_hooks_repo',
'python3-hook',
[os.devnull],
b"3\n['" + five.to_bytes(os.devnull) + b"']\nHello World\n",
f'3\n[{os.devnull!r}]\nHello World\n'.encode(),
)