From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 3 Apr 2024 13:32:55 +0000 (+0200) Subject: [3.12] gh-117166: Ignore empty and temporary dirs in `test_makefile` (GH-117190)... X-Git-Tag: v3.12.3~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fad48ea1816be3125ea51edcdfe2f999d6ade796;p=thirdparty%2FPython%2Fcpython.git [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 d9cfe7e565a6e2dc15747a904736264e31a10be4) Co-authored-by: Nikita Sobolev --- diff --git a/Lib/test/test_tools/test_makefile.py b/Lib/test/test_tools/test_makefile.py index 7222a054dcd6..17a1a6d0d38d 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)