Merge pull request #1148 from pre-commit/newline_fixup · precommit/pre-commit@2d0927d · GitHub
Skip to content

Commit 2d0927d

Browse files
authored
Merge pull request pre-commit#1148 from pre-commit/newline_fixup
Fix up some newlines in output
2 parents cfc4910 + 795506a commit 2d0927d

4 files changed

Lines changed: 39 additions & 36 deletions

File tree

pre_commit/error_handler.py

Lines changed: 27 additions & 30 deletions

pre_commit/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def to_bytes(self):
103103
),
104104
),
105105
b'Output: ', output[0], b'\n',
106-
b'Errors: ', output[1], b'\n',
106+
b'Errors: ', output[1],
107107
))
108108

109109
def to_text(self):

tests/error_handler_test.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,25 @@ def test_log_and_exit(cap_out, mock_store_dir):
113113
logged = f.read()
114114
expected = (
115115
r'^### version information\n'
116+
r'\n'
116117
r'```\n'
117-
r'pre-commit.version: \d+\.\d+\.\d+\n'
118-
r'sys.version:\n( .*\n)*'
118+
r'pre-commit version: \d+\.\d+\.\d+\n'
119+
r'sys.version:\n'
120+
r'( .*\n)*'
119121
r'sys.executable: .*\n'
120122
r'os.name: .*\n'
121123
r'sys.platform: .*\n'
122124
r'```\n'
125+
r'\n'
123126
r'### error information\n'
127+
r'\n'
124128
r'```\n'
125129
r'msg: FatalError: hai\n'
126-
r"I'm a stacktrace\n"
130+
r'```\n'
127131
r'\n'
128132
r'```\n'
133+
r"I'm a stacktrace\n"
134+
r'```\n'
129135
)
130136
assert re.match(expected, logged)
131137

tests/util_test.py

Lines changed: 2 additions & 2 deletions

0 commit comments

Comments
 (0)