summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2024-03-29 11:14:25 (GMT)
committerGitHub <noreply@github.com>2024-03-29 11:14:25 (GMT)
commitd9cfe7e565a6e2dc15747a904736264e31a10be4 (patch)
treee223ac5002eef357d495fef07a08aeeda6287475 /Lib/test
parent35b6c4a4da201a947b2ceb96ae4c0d83d4d2df4f (diff)
downloadcpython-d9cfe7e565a6e2dc15747a904736264e31a10be4.zip
cpython-d9cfe7e565a6e2dc15747a904736264e31a10be4.tar.gz
cpython-d9cfe7e565a6e2dc15747a904736264e31a10be4.tar.bz2
gh-117166: Ignore empty and temporary dirs in `test_makefile` (#117190)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_tools/test_makefile.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/test/test_tools/test_makefile.py b/Lib/test/test_tools/test_makefile.py
index 7222a05..17a1a6d 100644
--- a/Lib/test/test_tools/test_makefile.py
+++ b/Lib/test/test_tools/test_makefile.py
@@ -41,9 +41,17 @@ class TestMakefile(unittest.TestCase):
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)