MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / get_all_doctest_files

Function get_all_doctest_files

diffusers/utils/tests_fetcher.py:351–376  ·  view source on GitHub ↗

Return the complete list of python and Markdown files on which we run doctest. At this moment, we restrict this to only take files from `src/` or `docs/source/en/` that are not in `utils/not_doctested.txt`. Returns: `List[str]`: The complete list of Python and Markdown files o

()

Source from the content-addressed store, hash-verified

349
350
351def get_all_doctest_files() -> List[str]:
352 """
353 Return the complete list of python and Markdown files on which we run doctest.
354
355 At this moment, we restrict this to only take files from `src/` or `docs/source/en/` that are not in `utils/not_doctested.txt`.
356
357 Returns:
358 `List[str]`: The complete list of Python and Markdown files on which we run doctest.
359 """
360 py_files = [str(x.relative_to(PATH_TO_REPO)) for x in PATH_TO_REPO.glob("**/*.py")]
361 md_files = [str(x.relative_to(PATH_TO_REPO)) for x in PATH_TO_REPO.glob("**/*.md")]
362 test_files_to_run = py_files + md_files
363
364 # only include files in `src` or `docs/source/en/`
365 test_files_to_run = [x for x in test_files_to_run if x.startswith(("src/", "docs/source/en/"))]
366 # not include init files
367 test_files_to_run = [x for x in test_files_to_run if not x.endswith(("__init__.py",))]
368
369 # These are files not doctested yet.
370 with open("utils/not_doctested.txt") as fp:
371 not_doctested = {x.split(" ")[0] for x in fp.read().strip().split("\n")}
372
373 # So far we don't have 100% coverage for doctest. This line will be removed once we achieve 100%.
374 test_files_to_run = [x for x in test_files_to_run if x not in not_doctested]
375
376 return sorted(test_files_to_run)
377
378
379def get_new_doctest_files(repo, base_commit, branching_commit) -> List[str]:

Callers 1

get_doctest_filesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected