mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-16 02:21:46 +04:00
Fix py27 tests
This commit is contained in:
parent
53670d6a7e
commit
d07b9eaef4
2 changed files with 15 additions and 14 deletions
|
|
@ -89,7 +89,7 @@ def write_line(s=None, stream=stdout_byte_stream, logfile_name=None):
|
|||
output_stream.flush()
|
||||
|
||||
|
||||
class NormalOutput:
|
||||
class NormalOutput(object):
|
||||
def __init__(self, mgr):
|
||||
self.mgr = mgr
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ class LazyOutputProxy(NormalOutput):
|
|||
"""
|
||||
|
||||
def __init__(self, mgr):
|
||||
super().__init__(mgr)
|
||||
super(LazyOutputProxy, self).__init__(mgr)
|
||||
self._calls = []
|
||||
self.status = None
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ class LazyOutputProxy(NormalOutput):
|
|||
call()
|
||||
|
||||
|
||||
class NormalMode:
|
||||
class NormalMode(object):
|
||||
"""
|
||||
Normal output - pass calls to real methods
|
||||
"""
|
||||
|
|
@ -154,7 +154,7 @@ class QuietMode(NormalMode):
|
|||
output_proxy = LazyOutputProxy
|
||||
|
||||
def __init__(self, hooks, cols, clr):
|
||||
super().__init__(hooks, cols, clr)
|
||||
super(QuietMode, self).__init__(hooks, cols, clr)
|
||||
self._proxies = []
|
||||
self._closed = False
|
||||
self._msg = 'Running {} hooks'.format(len(hooks))
|
||||
|
|
@ -168,7 +168,7 @@ class QuietMode(NormalMode):
|
|||
|
||||
def get_output(self):
|
||||
""" Return new instance of collector """
|
||||
proxy = super().get_output()
|
||||
proxy = super(QuietMode, self).get_output()
|
||||
self._proxies.append(proxy)
|
||||
return proxy
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import os.path
|
|||
import pipes
|
||||
import subprocess
|
||||
import sys
|
||||
from itertools import chain
|
||||
|
||||
import mock
|
||||
import pytest
|
||||
|
|
@ -130,34 +131,34 @@ START_MSG_3_HOOKS = (
|
|||
@pytest.mark.parametrize(
|
||||
('expected_outputs', 'unexpected_outputs', 'args', 'exp_ret'), [
|
||||
(
|
||||
[*PASSED_MSG, *FAILED_MSG, *SKIPPED_MSG],
|
||||
[*START_MSG_3_HOOKS],
|
||||
chain(PASSED_MSG, FAILED_MSG, SKIPPED_MSG),
|
||||
chain(START_MSG_3_HOOKS),
|
||||
{'quiet': False}, 1,
|
||||
),
|
||||
(
|
||||
[*START_MSG_3_HOOKS, *FAILED_MSG],
|
||||
[*PASSED_MSG, *SKIPPED_MSG],
|
||||
chain(START_MSG_3_HOOKS, FAILED_MSG),
|
||||
chain(PASSED_MSG, SKIPPED_MSG),
|
||||
{'quiet': True}, 1,
|
||||
),
|
||||
(
|
||||
[b'Running 1 hooks', b'Passed'],
|
||||
[b'Passing hook', *SKIPPED_MSG, *FAILED_MSG],
|
||||
chain([b'Passing hook'], SKIPPED_MSG, FAILED_MSG),
|
||||
{'quiet': True, 'hook': 'passing_hook'}, 0,
|
||||
),
|
||||
(
|
||||
[b'Running 1 hooks', b'Skipped'],
|
||||
[b'Skipping hook', *FAILED_MSG],
|
||||
chain([b'Skipping hook'], FAILED_MSG),
|
||||
{'quiet': True, 'hook': 'skipping_hook'}, 0,
|
||||
),
|
||||
(
|
||||
[b'Running 1 hooks', b'Failed', *FAILED_MSG],
|
||||
chain([b'Running 1 hooks', b'Failed'], FAILED_MSG),
|
||||
[],
|
||||
{'quiet': True, 'hook': 'failing_hook'}, 1,
|
||||
),
|
||||
# Verbose must suppresses quiet mode
|
||||
(
|
||||
[*PASSED_MSG, *FAILED_MSG, *SKIPPED_MSG],
|
||||
[*START_MSG_3_HOOKS],
|
||||
chain(PASSED_MSG, FAILED_MSG, SKIPPED_MSG),
|
||||
chain(START_MSG_3_HOOKS),
|
||||
{'quiet': True, 'verbose': True}, 1,
|
||||
),
|
||||
],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue