Skip to content

Commit 96592c9

Browse files
same treatment for functional test update
1 parent fd2883e commit 96592c9

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

pylint/testutils/functional/lint_module_output_update.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,12 @@ def _check_output_text(
4040
with open(self._test_file.expected_output, "w", encoding="utf-8") as f:
4141
writer = csv.writer(f, dialect="test")
4242
for line in actual_output:
43-
writer.writerow(line.to_csv())
43+
try:
44+
writer.writerow(line.to_csv())
45+
except UnicodeEncodeError:
46+
writer.writerow(
47+
[
48+
s.encode("utf8", "ignore").decode("utf8")
49+
for s in line.to_csv()
50+
]
51+
)

pylint/testutils/lint_module_test.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,15 @@ def error_msg_for_unequal_output(
303303
expected_csv = StringIO()
304304
writer = csv.writer(expected_csv, dialect="test")
305305
for line in sorted(received_lines, key=sort_by_line_number):
306-
writer.writerow(line.to_csv())
306+
try:
307+
writer.writerow(line.to_csv())
308+
except UnicodeEncodeError:
309+
writer.writerow(
310+
[
311+
s.encode("utf8", "ignore").decode("utf8")
312+
for s in line.to_csv()
313+
]
314+
)
307315
error_msg += expected_csv.getvalue()
308316
return error_msg
309317

Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
"""This does not crash in the functional tests, but it does when called directly"""
2-
assert "\U00010000" == "\ud800\udc00"
1+
"""This does not crash in the functional tests, but it did when called directly."""
2+
3+
assert "\U00010000" == "\ud800\udc00" # [comparison-of-constants]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
comparison-of-constants:3:7:3:37::"Comparison between constants: '𐀀 == ' has a constant value":HIGH

0 commit comments

Comments
 (0)