Skip to content

Commit 6c12004

Browse files
same treatment for functional test update
1 parent 60175c2 commit 6c12004

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

pylint/testutils/functional/lint_module_output_update.py

Lines changed: 9 additions & 1 deletion
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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,15 @@ def error_msg_for_unequal_output(
308308
expected_csv = StringIO()
309309
writer = csv.writer(expected_csv, dialect="test")
310310
for line in sorted(received_lines, key=sort_by_line_number):
311-
writer.writerow(line.to_csv())
311+
try:
312+
writer.writerow(line.to_csv())
313+
except UnicodeEncodeError:
314+
writer.writerow(
315+
[
316+
s.encode("utf8", "ignore").decode("utf8")
317+
for s in line.to_csv()
318+
]
319+
)
312320
error_msg += expected_csv.getvalue()
313321
return error_msg
314322

Lines changed: 3 additions & 2 deletions
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]
Lines changed: 1 addition & 0 deletions
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)