8000 [3.12] gh-117166: Ignore empty and temporary dirs in `test_makefile` … · python/cpython@fad48ea · GitHub
[go: up one dir, main page]

Skip to content

Commit fad48ea

Browse files
[3.12] gh-117166: Ignore empty and temporary dirs in test_makefile (GH-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>
1 parent 06ba6c8 commit fad48ea

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