Unverified Commit 857bad6e authored by Yih-Dar's avatar Yih-Dar Committed by GitHub
Browse files

check paths in `utils/documentation_tests.txt` (#21315)



* check paths in utils/documentation_tests.txt

* check paths in utils/documentation_tests.txt
Co-authored-by: default avatarydshieh <ydshieh@users.noreply.github.com>
parent fd0ef8b6
......@@ -174,6 +174,7 @@ jobs:
- run: python utils/check_repo.py
- run: python utils/check_inits.py
- run: python utils/check_config_docstrings.py
- run: python utils/check_doctest_list.py
- run: make deps_table_check_updated
- run: python utils/tests_fetcher.py --sanity_check
- run: python utils/update_metadata.py --check-only
......
......@@ -40,6 +40,7 @@ repo-consistency:
python utils/check_repo.py
python utils/check_inits.py
python utils/check_config_docstrings.py
python utils/check_doctest_list.py
python utils/tests_fetcher.py --sanity_check
python utils/update_metadata.py --check-only
......
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
# All paths are set with the intent you should run this script from the root of the repo with the command
# python utils/check_doctest_list.py
REPO_PATH = "."
if __name__ == "__main__":
doctest_file_path = os.path.join(REPO_PATH, "utils/documentation_tests.txt")
non_existent_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)
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}")
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