mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-08 04:34:16 +00:00
Deal with platform line ending in tests
This commit is contained in:
parent
17820d7d83
commit
f353b1a1bf
1 changed files with 13 additions and 7 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from os import linesep
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from pre_commit_hooks.prepare_commit_msg import get_current_branch
|
from pre_commit_hooks.prepare_commit_msg import get_current_branch
|
||||||
|
|
@ -58,13 +60,14 @@ TESTS = (
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
b'',
|
b'',
|
||||||
b'\n\nRelates: #AA-01\n\n',
|
f'{linesep}{linesep}Relates: #AA-01{linesep}{linesep}'.encode(),
|
||||||
'feature/AA-01',
|
'feature/AA-01',
|
||||||
get_template_path('prepare_commit_msg_append.j2'),
|
get_template_path('prepare_commit_msg_append.j2'),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
b'Initial message',
|
b'Initial message',
|
||||||
b'Initial message\n\nRelates: #AA-02\n\n',
|
f'Initial message{linesep}{linesep}Relates: #AA-02{linesep}{linesep}'
|
||||||
|
.encode(),
|
||||||
'feature/AA-02',
|
'feature/AA-02',
|
||||||
get_template_path('prepare_commit_msg_append.j2'),
|
get_template_path('prepare_commit_msg_append.j2'),
|
||||||
),
|
),
|
||||||
|
|
@ -120,15 +123,18 @@ def test_main(
|
||||||
|
|
||||||
TESTS_TEMPLATES = (
|
TESTS_TEMPLATES = (
|
||||||
(
|
(
|
||||||
b'Initial Message\n\n# Git commented\n# output simulated',
|
f'Initial Message{linesep}{linesep}# Git commented{linesep}# '
|
||||||
b'[1.0.0] Initial Message\n\n# Git commented\n# output simulated',
|
f'output simulated'.encode(),
|
||||||
|
f'[1.0.0] Initial Message{linesep}{linesep}# Git commented{linesep}# '
|
||||||
|
f'output simulated'.encode(),
|
||||||
'release/1.0.0', # but this should
|
'release/1.0.0', # but this should
|
||||||
get_template_path('prepare_commit_msg_prepend.j2'),
|
get_template_path('prepare_commit_msg_prepend.j2'),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
b'Initial Message\n# Git commented\n# output simulated',
|
f'Initial Message{linesep}# Git commented{linesep}# output '
|
||||||
b'Initial Message\n\nRelates: #1.0.0\n\n'
|
f'simulated'.encode(),
|
||||||
b'# Git commented\n# output simulated',
|
f'Initial Message{linesep}{linesep}Relates: #1.0.0{linesep}{linesep}'
|
||||||
|
f'# Git commented{linesep}# output simulated'.encode(),
|
||||||
'release/1.0.0', # but this should
|
'release/1.0.0', # but this should
|
||||||
get_template_path('prepare_commit_msg_append.j2'),
|
get_template_path('prepare_commit_msg_append.j2'),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue