10000 gh-109402: Fix regrtest findtests() (#109403) · python/cpython@9ccd2e6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9ccd2e6

Browse files
authored
gh-109402: Fix regrtest findtests() (#109403)
Check for the full module name in SPLITTESTDIRS, not the relative module name.
1 parent d7a27e5 commit 9ccd2e6

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Lib/test/libregrtest/findtests.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,19 @@ def findtests(*, testdir: StrPath | None = None, exclude=(),
3838
mod, ext = os.path.splitext(name)
3939
if (not mod.startswith("test_")) or (mod in exclude):
4040
continue
41-
if mod in split_test_dirs:
41+
if base_mod:
42+
fullname = f"{base_mod}.{mod}"
43+
else:
44+
fullname = mod
45+
if fullname in split_test_dirs:
4246
subdir = os.path.join(testdir, mod)
43-
mod = f"{base_mod or 'test'}.{mod}"
47+
if not base_mod:
48+
fullname = f"test.{mod}"
4449
tests.extend(findtests(testdir=subdir, exclude=exclude,
4550
split_test_dirs=split_test_dirs,
46-
base_mod=mod))
51+
base_mod=fullname))
4752
elif ext in (".py", ""):
48-
tests.append(f"{base_mod}.{mod}" if base_mod else mod)
53+
tests.append(fullname)
4954
return sorted(tests)
5055

5156

0 commit comments

Comments
 (0)
0