From 601115ce92b8dce68679c6fa83ab8bf1c9c7b8a7 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Thu, 14 Sep 2023 15:53:56 +0300 Subject: [PATCH] gh-109402: Fix `libregrtest` when module matches folder name --- Lib/test/libregrtest/findtests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/libregrtest/findtests.py b/Lib/test/libregrtest/findtests.py index f4a8b9ae26ae65..a8ac53a69e8e8a 100644 --- a/Lib/test/libregrtest/findtests.py +++ b/Lib/test/libregrtest/findtests.py @@ -38,7 +38,7 @@ def findtests(*, testdir: StrPath | None = None, exclude=(), mod, ext = os.path.splitext(name) if (not mod.startswith("test_")) or (mod in exclude): continue - if mod in split_test_dirs: + if mod in split_test_dirs and os.path.isdir(mod): subdir = os.path.join(testdir, mod) mod = f"{base_mod or 'test'}.{mod}" tests.extend(findtests(testdir=subdir, exclude=exclude,