[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 d9cfe7e565)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
Miss Islington (bot) 2024-04-03 15:32:55 +02:00 committed by GitHub
parent 06ba6c86d2
commit fad48ea181
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)