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