Skip to content

Commit 3b8c3b2

Browse files
committed
add cross-platform newline support in tests
1 parent a975aae commit 3b8c3b2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/test_stringbuilder.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
import pytest
24

35
import pathins.stringbuilder
@@ -132,7 +134,7 @@ def mock_isatty():
132134
monkeypatch.setattr(pathins.stringbuilder, "IS_A_TTY", mock_isatty)
133135

134136
res = pathins.stringbuilder.report_header("TEST")
135-
assert res == "-----\n\033[1;96mTEST\033[0m\n-----"
137+
assert res == f"-----{os.linesep}\033[1;96mTEST\033[0m{os.linesep}-----"
136138

137139

138140
def test_report_header_nocolor(monkeypatch):
@@ -144,7 +146,7 @@ def mock_isatty():
144146
monkeypatch.setattr(pathins.stringbuilder, "IS_A_TTY", mock_isatty)
145147

146148
res = pathins.stringbuilder.report_header("TEST", nocolor=True)
147-
assert res == "-----\nTEST\n-----"
149+
assert res == f"-----{os.linesep}TEST{os.linesep}-----"
148150

149151

150152
# def test_overlap_result_pass_default(monkeypatch):

0 commit comments

Comments
 (0)