8000 gh-117166: Ignore empty and temporary dirs in `test_makefile` (#117190) · python/cpython@d9cfe7e · GitHub
[go: up one dir, main page]

Skip to content

Commit d9cfe7e

Browse files
authored
gh-117166: Ignore empty and temporary dirs in test_makefile (#117190)
1 parent 35b6c4a commit d9cfe7e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Lib/test/test_tools/test_makefile.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,17 @@ def test_makefile_test_folders(self):
4141
self.assertIn(idle_test, test_dirs)
4242

4343
used = [idle_test]
44-
for dirpath, _, _ in os.walk(support.TEST_HOME_DIR):
44+
for dirpath, dirs, files in os.walk(support.TEST_HOME_DIR):
4545
dirname = os.path.basename(dirpath)
46-
if dirname == '__pycache__':
46+
# Skip temporary dirs:
47+
if dirname == '__pycache__' or dirname.startswith('.'):
48+
dirs.clear() # do not process subfolders
49+
continue
50+
# Skip empty dirs:
51+
if not dirs and not files:
52+
continue
53+
# Skip dirs with hidden-only files:
54+
if files and all(filename.startswith('.') for filename in files):
4755
continue
4856

4957
relpath = os.path.relpath(dirpath, support.STDLIB_DIR)

0 commit comments

Comments
 (0)
0