| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -539,11 +539,14 @@ def __init__(self, pat, child_parts): | |||
| 539 | 539 | ||
| 540 | 540 | def _iterate_directories(self, parent_path, is_dir, listdir): | |
| 541 | 541 | yield parent_path | |
| 542 | - for name in listdir(parent_path): | ||
| 543 | - path = parent_path._make_child_relpath(name) | ||
| 544 | - if is_dir(path) and not path.is_symlink(): | ||
| 545 | - for p in self._iterate_directories(path, is_dir, listdir): | ||
| 546 | - yield p | ||
| 542 | + try: | ||
| 543 | + for name in listdir(parent_path): | ||
| 544 | + path = parent_path._make_child_relpath(name) | ||
| 545 | + if is_dir(path) and not path.is_symlink(): | ||
| 546 | + for p in self._iterate_directories(path, is_dir, listdir): | ||
| 547 | + yield p | ||
| 548 | + except PermissionError: | ||
| 549 | + return | ||
| 547 | 550 | ||
| 548 | 551 | def _select_from(self, parent_path, is_dir, exists, listdir): | |
| 549 | 552 | try: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1236,7 +1236,7 @@ class _BasePathTest(object): | |||
| 1236 | 1236 | # | |-- dirD | |
| 1237 | 1237 | # | | `-- fileD | |
| 1238 | 1238 | # | `-- fileC | |
| 1239 | - # |-- dirE | ||
| 1239 | + # |-- dirE # No permissions | ||
| 1240 | 1240 | # |-- fileA | |
| 1241 | 1241 | # |-- linkA -> fileA | |
| 1242 | 1242 | # `-- linkB -> dirB | |
@@ -1453,13 +1453,13 @@ def _check(glob, expected): | |||
| 1453 | 1453 | p = P(BASE) | |
| 1454 | 1454 | it = p.rglob("fileA") | |
| 1455 | 1455 | self.assertIsInstance(it, collections.Iterator) | |
| 1456 | - # XXX cannot test because of symlink loops in the test setup | ||
| 1457 | - #_check(it, ["fileA"]) | ||
| 1458 | - #_check(p.rglob("fileB"), ["dirB/fileB"]) | ||
| 1459 | - #_check(p.rglob("*/fileA"), [""]) | ||
| 1460 | - #_check(p.rglob("*/fileB"), ["dirB/fileB"]) | ||
| 1461 | - #_check(p.rglob("file*"), ["fileA", "dirB/fileB"]) | ||
| 1462 | - # No symlink loops here | ||
| 1456 | + _check(it, ["fileA"]) | ||
| 1457 | + _check(p.rglob("fileB"), ["dirB/fileB"]) | ||
| 1458 | + _check(p.rglob("*/fileA"), []) | ||
| 1459 | + _check(p.rglob("*/fileB"), ["dirB/fileB", "dirB/linkD/fileB", | ||
| 1460 | + "linkB/fileB", "dirA/linkC/fileB"]) | ||
| 1461 | + _check(p.rglob("file*"), ["fileA", "dirB/fileB", | ||
| 1462 | + "dirC/fileC", "dirC/dirD/fileD"]) | ||
| 1463 | 1463 | p = P(BASE, "dirC") | |
| 1464 | 1464 | _check(p.rglob("file*"), ["dirC/fileC", "dirC/dirD/fileD"]) | |
| 1465 | 1465 | _check(p.rglob("*/*"), ["dirC/dirD/fileD"]) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments