Skip to content

Commit cf5a9e6

Browse files
committed
tests: add regression test for expand_modules
1 parent e4b7473 commit cf5a9e6

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/lint/unittest_expand_modules.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,3 +326,23 @@ def test_expand_modules_with_ignore(
326326
)
327327
assert {k: v for k, v in modules.items() if not v["isignored"]} == expected
328328
assert not errors
329+
330+
@set_config(ignore=["test"])
331+
def test_expand_modules_with_ignore_list(self) -> None:
332+
"""Test expand_modules with a non-default value of ignore."""
333+
ignore_list: list[str] = self.linter.config.ignore
334+
ignore_list_re = (re.compile('^\\.#'),)
335+
path = Path(__file__).parent.parent / "regrtest_data" / "ignore_option_10669"
336+
modules, errors = expand_modules(
337+
[str(path)],
338+
[],
339+
ignore_list,
340+
ignore_list_re,
341+
[],
342+
)
343+
expected_keys = {
344+
str(path / "__init__.py"),
345+
str(path / "main.py"),
346+
}
347+
assert {k for k, v in modules.items() if not v["isignored"]} == expected_keys
348+
assert not errors

0 commit comments

Comments
 (0)