File tree 3 files changed +27
-0
lines changed
3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,11 @@ Release date: TBA
9
9
10
10
Closes #6950
11
11
12
+ * Fixed an issue where scanning `. ` directory recursively with ``--ignore-path=^path/to/dir `` is not
13
+ ignoring the `path/to/dir ` directory.
14
+
15
+ Closes #6964
16
+
12
17
* Fixed regression that didn't allow quoted ``init-hooks `` in option files.
13
18
14
19
Closes #7006
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ def _is_ignored_file(
52
52
ignore_list_re : list [Pattern [str ]],
53
53
ignore_list_paths_re : list [Pattern [str ]],
54
54
) -> bool :
55
+ element = os .path .normpath (element )
55
56
basename = os .path .basename (element )
56
57
return (
57
58
basename in ignore_list
Original file line number Diff line number Diff line change @@ -1330,6 +1330,27 @@ def test_recursive_current_dir(self):
1330
1330
code = 0 ,
1331
1331
)
1332
1332
1333
+ def test_ignore_path_recursive_current_dir (self ) -> None :
1334
+ """Tests that path is normalized before checked that is ignored. GitHub issue #6964"""
1335
+ with _test_sys_path ():
1336
+ # pytest is including directory HERE/regrtest_data to sys.path which causes
1337
+ # astroid to believe that directory is a package.
1338
+ sys .path = [
1339
+ path
1340
+ for path in sys .path
1341
+ if not os .path .basename (path ) == "regrtest_data"
1342
+ ]
1343
+ with _test_cwd ():
1344
+ os .chdir (join (HERE , "regrtest_data" , "directory" ))
1345
+ self ._runtest (
1346
+ [
1347
+ "." ,
1348
+ "--recursive=y" ,
1349
+ "--ignore-paths=^ignored_subdirectory/.*" ,
1350
+ ],
1351
+ code = 0 ,
1352
+ )
1353
+
1333
1354
def test_regression_recursive_current_dir (self ):
1334
1355
with _test_sys_path ():
1335
1356
# pytest is including directory HERE/regrtest_data to sys.path which causes
You can’t perform that action at this time.
0 commit comments