MCPcopy Index your code
hub / github.com/RustPython/RustPython / findtests

Function findtests

Lib/test/libregrtest/findtests.py:38–61  ·  view source on GitHub ↗

Return a list of all applicable test modules.

(*, testdir: StrPath | None = None, exclude: Container[str] = (),
              split_test_dirs: set[TestName] = SPLITTESTDIRS,
              base_mod: str = "")

Source from the content-addressed store, hash-verified

36
37
38def findtests(*, testdir: StrPath | None = None, exclude: Container[str] = (),
39 split_test_dirs: set[TestName] = SPLITTESTDIRS,
40 base_mod: str = "") -> TestList:
41 """Return a list of all applicable test modules."""
42 testdir = findtestdir(testdir)
43 tests = []
44 for name in os.listdir(testdir):
45 mod, ext = os.path.splitext(name)
46 if (not mod.startswith("test_")) or (mod in exclude):
47 continue
48 if base_mod:
49 fullname = f"{base_mod}.{mod}"
50 else:
51 fullname = mod
52 if fullname in split_test_dirs:
53 subdir = os.path.join(testdir, mod)
54 if not base_mod:
55 fullname = f"test.{mod}"
56 tests.extend(findtests(testdir=subdir, exclude=exclude,
57 split_test_dirs=split_test_dirs,
58 base_mod=fullname))
59 elif ext in (".py", ""):
60 tests.append(fullname)
61 return sorted(tests)
62
63
64def split_test_packages(tests, *, testdir: StrPath | None = None,

Callers 3

find_testsMethod · 0.90
jsontests.pyFile · 0.90
split_test_packagesFunction · 0.85

Calls 8

findtestdirFunction · 0.85
sortedFunction · 0.85
listdirMethod · 0.80
splitextMethod · 0.80
startswithMethod · 0.45
joinMethod · 0.45
extendMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected