Skip to content

Commit 49bf1a7

Browse files
same treatment for functional test update
1 parent 3c4cdb8 commit 49bf1a7

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
@@ -309,7 +309,15 @@ def error_msg_for_unequal_output(
309309
expected_csv = StringIO()
310310
writer = csv.writer(expected_csv, dialect="test")
311311
for line in sorted(received_lines, key=sort_by_line_number):
312-
writer.writerow(line.to_csv())
312+
try:
313+
writer.writerow(line.to_csv())
314+
except UnicodeEncodeError:
315+
writer.writerow(
316+
[
317+
s.encode("utf8", "ignore").decode("utf8")
318+
for s in line.to_csv()
319+
]
320+
)
313321
error_msg += expected_csv.getvalue()
314322
return error_msg
315323

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)