mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-07 04:26:52 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
19609da705
commit
04bf47cb9b
2 changed files with 14 additions and 12 deletions
|
|
@ -43,7 +43,7 @@ def main(argv: Sequence[str] | None = None) -> int:
|
||||||
for i, line in enumerate(inputfile, start=1):
|
for i, line in enumerate(inputfile, start=1):
|
||||||
# Look for conflict patterns in order
|
# Look for conflict patterns in order
|
||||||
if line.startswith(
|
if line.startswith(
|
||||||
CONFLICT_PATTERNS[expected_conflict_pattern_index]
|
CONFLICT_PATTERNS[expected_conflict_pattern_index],
|
||||||
):
|
):
|
||||||
expected_conflict_pattern_index += 1
|
expected_conflict_pattern_index += 1
|
||||||
if expected_conflict_pattern_index == N:
|
if expected_conflict_pattern_index == N:
|
||||||
|
|
|
||||||
|
|
@ -113,18 +113,19 @@ def test_merge_conflicts_git(capsys):
|
||||||
# Individual markers are not actually merge conflicts, need 3 markers
|
# Individual markers are not actually merge conflicts, need 3 markers
|
||||||
# to mark a real conflict
|
# to mark a real conflict
|
||||||
'contents, expected_retcode',
|
'contents, expected_retcode',
|
||||||
((b'<<<<<<< ', 0),
|
(
|
||||||
|
(b'<<<<<<< ', 0),
|
||||||
(b'=======', 0),
|
(b'=======', 0),
|
||||||
(b'>>>>>>> ',0),
|
(b'>>>>>>> ', 0),
|
||||||
# Real conflict marker
|
# Real conflict marker
|
||||||
(b'<<<<<<< HEAD\n=======\n>>>>>>> branch\n', 1),
|
(b'<<<<<<< HEAD\n=======\n>>>>>>> branch\n', 1),
|
||||||
# Allow for the possibility of an .rst file with a =======
|
# Allow for the possibility of an .rst file with a =======
|
||||||
# inside a conflict marker
|
# inside a conflict marker
|
||||||
(b'<<<<<<< HEAD\n=======\n=======\n>>>>>>> branch\n', 1),
|
(b'<<<<<<< HEAD\n=======\n=======\n>>>>>>> branch\n', 1),
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
def test_merge_conflicts_with_rst(
|
def test_merge_conflicts_with_rst(
|
||||||
contents, expected_retcode, repository_pending_merge
|
contents, expected_retcode, repository_pending_merge,
|
||||||
):
|
):
|
||||||
repository_pending_merge.join('f2.rst').write_binary(contents)
|
repository_pending_merge.join('f2.rst').write_binary(contents)
|
||||||
assert main(['f2.rst']) == expected_retcode
|
assert main(['f2.rst']) == expected_retcode
|
||||||
|
|
@ -149,6 +150,7 @@ def test_does_not_care_when_not_in_a_merge(tmpdir):
|
||||||
f.write_binary(b'problem\n=======\n')
|
f.write_binary(b'problem\n=======\n')
|
||||||
assert main([str(f.realpath())]) == 0
|
assert main([str(f.realpath())]) == 0
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
'contents, expected_retcode',
|
'contents, expected_retcode',
|
||||||
(
|
(
|
||||||
|
|
@ -156,7 +158,7 @@ def test_does_not_care_when_not_in_a_merge(tmpdir):
|
||||||
(b'=======', 0),
|
(b'=======', 0),
|
||||||
# Complete conflict marker
|
# Complete conflict marker
|
||||||
(b'<<<<<<< HEAD\nproblem\n=======\n>>>>>>> branch\n', 1),
|
(b'<<<<<<< HEAD\nproblem\n=======\n>>>>>>> branch\n', 1),
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
def test_care_when_assumed_merge(contents, expected_retcode, tmpdir):
|
def test_care_when_assumed_merge(contents, expected_retcode, tmpdir):
|
||||||
f = tmpdir.join('README.md')
|
f = tmpdir.join('README.md')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue