Skip to content

Commit 71caace

Browse files
authored
Add regression tests for false positive relative-beyond-top-level in parallel mode with namespace packages (#10889)
1 parent 7f2b8cf commit 71caace

3 files changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
B = 1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from ..b import B

tests/test_self.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,49 @@ def test_regression_parallel_mode_without_filepath(self) -> None:
10791079
)
10801080
self._test_output([path, "-j2"], expected_output="")
10811081

1082+
@pytest.mark.needs_two_cores
1083+
@pytest.mark.parametrize(
1084+
"args",
1085+
[
1086+
[
1087+
"--jobs",
1088+
"0",
1089+
"--disable=all",
1090+
"--enable=relative-beyond-top-level",
1091+
"--source-roots",
1092+
".",
1093+
"--recursive=y",
1094+
"a/",
1095+
],
1096+
[
1097+
"--jobs",
1098+
"1",
1099+
"--disable=all",
1100+
"--enable=relative-beyond-top-level",
1101+
"--source-roots",
1102+
".",
1103+
"a/c/d.py",
1104+
],
1105+
[
1106+
"--jobs",
1107+
"0",
1108+
"--disable=all",
1109+
"--enable=relative-beyond-top-level",
1110+
"--source-roots",
1111+
".",
1112+
"a/c/d.py",
1113+
],
1114+
],
1115+
ids=["jobs-0-dir", "jobs-1-file", "jobs-0-file"],
1116+
)
1117+
def test_issue_10794_relative_beyond_top_level_parallel_specific_file(
1118+
self, args: list[str]
1119+
) -> None:
1120+
"""Regression test for https://github.com/pylint-dev/pylint/issues/10794."""
1121+
path = join(HERE, "regrtest_data", "pep420", "issue_10794")
1122+
with _test_cwd(path):
1123+
self._runtest(args, code=0)
1124+
10821125
def test_output_file_valid_path(self, tmp_path: Path) -> None:
10831126
path = join(HERE, "regrtest_data", "unused_variable.py")
10841127
output_file = tmp_path / "output.txt"

0 commit comments

Comments
 (0)