Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] Use an empty pylintrc so tests to not depend on system's conf #8350

Merged
merged 2 commits into from
Feb 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions tests/checkers/unittest_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

from pylint.checkers import imports
from pylint.interfaces import UNDEFINED
from pylint.lint import Run
from pylint.testutils import CheckerTestCase, MessageTest
from pylint.testutils._run import _Run as Run

REGR_DATA = os.path.join(os.path.dirname(__file__), "..", "regrtest_data", "")

Expand Down Expand Up @@ -206,7 +206,7 @@ def test_allow_reexport_package(capsys: CaptureFixture[str]) -> None:
exit=False,
)
output, errors = capsys.readouterr()
assert len(output.split("\n")) == 5, f"Expected 5 line breaks in:{output}"
assert len(output.split("\n")) == 7, f"Expected 7 line breaks in:{output}"
assert (
"__init__.py:1:0: C0414: Import alias does not rename original package (useless-import-alias)"
in output
Expand All @@ -222,6 +222,7 @@ def test_allow_reexport_package(capsys: CaptureFixture[str]) -> None:
[
f"{os.path.join(REGR_DATA, 'allow_reexport')}",
"--allow-reexport-from-package=yes",
"--disable=missing-module-docstring",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're forced to do it this way because of the check line 232

"-sn",
],
exit=False,
Expand Down
10 changes: 9 additions & 1 deletion tests/config/pylint_config/test_pylint_config_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,15 @@ def test_writing_minimal_file(
assert any(line.startswith("#") for line in captured.out.splitlines())

# Check minimal doesn't have comments and no default values
Run(["--accept-no-return-doc=y", "generate", "--interactive"], exit=False)
Run(
[
"--load-plugins=pylint.extensions.docparams",
"--accept-no-return-doc=y",
"generate",
"--interactive",
],
exit=False,
)
captured = capsys.readouterr()
assert not any(i.startswith("#") for i in captured.out.split("\n"))
assert "accept-no-return-doc" not in captured.out
2 changes: 1 addition & 1 deletion tests/config/test_per_directory_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from pathlib import Path

from pylint.lint import Run
from pylint.testutils._run import _Run as Run


def test_fall_back_on_base_config(tmp_path: Path) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pylint_runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import pytest

from pylint import run_epylint, run_pylint, run_pyreverse, run_symilar
from pylint.lint import Run
from pylint.testutils import GenericTestReporter as Reporter
from pylint.testutils._run import _Run as Run
from pylint.testutils.utils import _test_cwd

if sys.version_info >= (3, 8):
Expand Down