Skip to content

Conversation

@ydshieh
Copy link
Collaborator

@ydshieh ydshieh commented Aug 23, 2023

What does this PR do?

Let's remove utils/documentation_tests.txt and just keep not_doctested.txt

Comment on lines -399 to -401
# These are files not doctested yet.
with open("utils/not_doctested.txt") as fp:
not_doctested = set(fp.read().strip().split("\n"))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this to the new get_all_doctest_files above

Comment on lines -405 to -413

# So far we don't have 100% coverage for doctest. This line will be removed once we achieve 100%.
test_files_to_run = [x for x in test_files_to_run if x not in not_doctested and x not in slow_documentation_tests]

# The file `utils/not_doctested.txt` doesn't contain all files that are not doc-tested, so we need more filters.
# 1. only include files in `src` or `docs/source/en/`
test_files_to_run = [x for x in test_files_to_run if x.startswith(("src/", "docs/source/en/"))]
# 2. not include init files
test_files_to_run = [x for x in test_files_to_run if not x.endswith(("__init__.py",))]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment

Comment on lines +383 to +384
# only include files in `src` or `docs/source/en/`
test_files_to_run = [x for x in test_files_to_run if x.startswith(("src/", "docs/source/en/"))]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have docs/source/es/quicktour.md tested so far with documentation_tests on daily CI. But the logic becomes a bit complex if to deal with language other than en. Let me know your preference.

Comment on lines +46 to +52
- name: Get doctest files
run: |
$(python3 -c 'from utils.tests_fetcher import get_all_doctest_files; to_test = get_all_doctest_files(); to_test = " ".join(to_test); fp = open("doc_tests.txt", "w"); fp.write(to_test); fp.close()')
- name: Run doctests
run: |
python3 -m pytest -v --make-reports doc_tests_gpu --doctest-modules $(cat utils/documentation_tests.txt) -sv --doctest-continue-on-failure --doctest-glob="*.md"
python3 -m pytest -v --make-reports doc_tests_gpu --doctest-modules $(cat doc_tests.txt) -sv --doctest-continue-on-failure --doctest-glob="*.md"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the new get_all_doctest_files defined below

return code_diff


def get_all_doctest_files() -> List[str]:
Copy link
Collaborator Author

@ydshieh ydshieh Aug 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for daily doctest CI to use

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool. Hope we won't have surprises in the ci daily

@ydshieh ydshieh merged commit b413e06 into main Aug 23, 2023
@ydshieh ydshieh deleted the update_doctest_way branch August 23, 2023 09:14
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

@amyeroberts amyeroberts mentioned this pull request Aug 30, 2023
parambharat pushed a commit to parambharat/transformers that referenced this pull request Sep 26, 2023
* fix

* fix

* fix

* fix

* fix

* fix

* Apply suggestions from code review

Co-authored-by: Arthur <[email protected]>

---------

Co-authored-by: ydshieh <[email protected]>
Co-authored-by: Arthur <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants