|
22 | 22 | """Functional full-module tests for PyLint."""
|
23 | 23 |
|
24 | 24 | import csv
|
25 |
| -import io |
26 | 25 | import os
|
27 | 26 | import sys
|
28 |
| -import warnings |
29 | 27 |
|
30 | 28 | import pytest
|
31 | 29 |
|
@@ -53,38 +51,13 @@ class test_dialect(csv.excel):
|
53 | 51 | class LintModuleOutputUpdate(testutils.LintModuleTest):
|
54 | 52 | """If message files should be updated instead of checked."""
|
55 | 53 |
|
56 |
| - def _open_expected_file(self): |
57 |
| - try: |
58 |
| - return super()._open_expected_file() |
59 |
| - except OSError: |
60 |
| - return io.StringIO() |
61 |
| - |
62 |
| - @classmethod |
63 |
| - def _split_lines(cls, expected_messages, lines): |
64 |
| - emitted, omitted = [], [] |
65 |
| - for msg in lines: |
66 |
| - if (msg[1], msg[0]) in expected_messages: |
67 |
| - emitted.append(msg) |
68 |
| - else: |
69 |
| - omitted.append(msg) |
70 |
| - return emitted, omitted |
71 |
| - |
72 |
| - def _check_output_text(self, expected_messages, expected_output, actual_output): |
73 |
| - if not expected_messages: |
| 54 | + def _check_output_text(self, _, expected_output, actual_output): |
| 55 | + if expected_output == actual_output: |
74 | 56 | return
|
75 |
| - emitted, remaining = self._split_lines(expected_messages, expected_output) |
76 |
| - if emitted != actual_output: |
77 |
| - remaining.extend(actual_output) |
78 |
| - remaining.sort(key=lambda m: (m[1], m[0], m[3])) |
79 |
| - warnings.warn( |
80 |
| - "Updated '{}' with the new content generated from '{}'".format( |
81 |
| - self._test_file.expected_output, self._test_file.base |
82 |
| - ) |
83 |
| - ) |
84 |
| - with open(self._test_file.expected_output, "w") as fobj: |
85 |
| - writer = csv.writer(fobj, dialect="test") |
86 |
| - for line in remaining: |
87 |
| - writer.writerow(line.to_csv()) |
| 57 | + with open(self._test_file.expected_output, "w") as f: |
| 58 | + writer = csv.writer(f, dialect="test") |
| 59 | + for line in actual_output: |
| 60 | + writer.writerow(line.to_csv()) |
88 | 61 |
|
89 | 62 |
|
90 | 63 | def get_tests():
|
|
0 commit comments