summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2019-05-20 09:05:01 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2019-05-20 09:05:01 +0200
commit50a670b1eee2a28c771daceeb169a0db4805ddae (patch)
tree7d1c0d1f1ffd6a60b9106a25acac3e7c995a8333
parent36f206b5856d384c1531a41a7c73099859b99e71 (diff)
downloadpylint-git-50a670b1eee2a28c771daceeb169a0db4805ddae.tar.gz
Expect only certain errors from self regression tests
These changes should fix a couple of failing tests when running the suite with pytest instead of tox. The reason for those failures was that pylint was reusing the config file from the root directory and some of its messages are disabled there. Close #2819
-rw-r--r--pylint/test/test_self.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/pylint/test/test_self.py b/pylint/test/test_self.py
index 1d90845dd..b5000f98e 100644
--- a/pylint/test/test_self.py
+++ b/pylint/test/test_self.py
@@ -581,7 +581,6 @@ class TestRunTC(object):
def test_stdin(self, input_path, module, expected_path):
expected_output = (
"************* Module {module}\n"
- "{path}:1:0: C0111: Missing module docstring (missing-docstring)\n"
"{path}:1:0: W0611: Unused import os (unused-import)\n\n"
).format(path=expected_path, module=module)
@@ -589,7 +588,8 @@ class TestRunTC(object):
"pylint.lint._read_stdin", return_value="import os\n"
) as mock_stdin:
self._test_output(
- ["--from-stdin", input_path], expected_output=expected_output
+ ["--from-stdin", input_path, "--disable=all", "--enable=unused-import"],
+ expected_output=expected_output,
)
assert mock_stdin.call_count == 1
@@ -629,19 +629,27 @@ class TestRunTC(object):
os.chdir(str(tmpdir))
expected = (
"************* Module a.b\n"
- "a/b.py:1:0: C0111: Missing module docstring (missing-docstring)\n"
"a/b.py:3:0: E0401: Unable to import 'a.d' (import-error)\n\n"
)
if write_bpy_to_disk:
# --from-stdin is not used here
- self._test_output(["a/b.py"], expected_output=expected)
+ self._test_output(
+ ["a/b.py", "--disable=all", "--enable=import-error"],
+ expected_output=expected,
+ )
# this code needs to work w/ and w/o a file named a/b.py on the
# harddisk.
with mock.patch("pylint.lint._read_stdin", return_value=b_code):
self._test_output(
- ["--from-stdin", join("a", "b.py")], expected_output=expected
+ [
+ "--from-stdin",
+ join("a", "b.py"),
+ "--disable=all",
+ "--enable=import-error",
+ ],
+ expected_output=expected,
)
finally: