Unverified Commit f3e96235 authored by amyeroberts's avatar amyeroberts Committed by GitHub
Browse files

documentation_tests.txt - sort filenames alphabetically (#24647)

* Sort filenames alphabetically

* Add check for order
parent a3b402ff
......@@ -24,12 +24,16 @@ REPO_PATH = "."
if __name__ == "__main__":
doctest_file_path = os.path.join(REPO_PATH, "utils/documentation_tests.txt")
non_existent_paths = []
all_paths = []
with open(doctest_file_path) as fp:
for line in fp:
line = line.strip()
path = os.path.join(REPO_PATH, line)
if not (os.path.isfile(path) or os.path.isdir(path)):
non_existent_paths.append(line)
all_paths.append(path)
if len(non_existent_paths) > 0:
non_existent_paths = "\n".join(non_existent_paths)
raise ValueError(f"`utils/documentation_tests.txt` contains non-existent paths:\n{non_existent_paths}")
if all_paths != sorted(all_paths):
raise ValueError("Files in `utils/documentation_tests.txt` are not in alphabetical order.")
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment