Skip to content

Commit

Permalink
[3.12] gh-117166: Ignore empty and temporary dirs in test_makefile (G…
Browse files Browse the repository at this point in the history
…H-117190) (GH-117367)

gh-117166: Ignore empty and temporary dirs in `test_makefile` (GH-117190)
(cherry picked from commit d9cfe7e)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
  • Loading branch information
miss-islington and sobolevn authored Apr 3, 2024
1 parent 06ba6c8 commit fad48ea
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Lib/test/test_tools/test_makefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,17 @@ def test_makefile_test_folders(self):
self.assertIn(idle_test, test_dirs)

used = [idle_test]
for dirpath, _, _ in os.walk(support.TEST_HOME_DIR):
for dirpath, dirs, files in os.walk(support.TEST_HOME_DIR):
dirname = os.path.basename(dirpath)
if dirname == '__pycache__':
# Skip temporary dirs:
if dirname == '__pycache__' or dirname.startswith('.'):
dirs.clear() # do not process subfolders
continue
# Skip empty dirs:
if not dirs and not files:
continue
# Skip dirs with hidden-only files:
if files and all(filename.startswith('.') for filename in files):
continue

relpath = os.path.relpath(dirpath, support.STDLIB_DIR)
Expand Down

0 comments on commit fad48ea

Please sign in to comment.