Skip to content

Commit

Permalink
[test] Use an empty pylintrc so tests to not depend on system's conf (#…
Browse files Browse the repository at this point in the history
…8350) (#8351)

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

Closes #8342

* Update tests/checkers/unittest_imports.py

Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>

---------

Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
(cherry picked from commit 641f526)

Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
  • Loading branch information
github-actions[bot] and Pierre-Sassoulas authored Feb 27, 2023
1 parent e734d56 commit ff8cdd2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
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 @@ -152,7 +152,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 @@ -168,6 +168,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",
"-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

0 comments on commit ff8cdd2

Please sign in to comment.