diff --git a/docs/README.md b/docs/README.md index 9aa74d4de9..b4278cc0dc 100644 --- a/docs/README.md +++ b/docs/README.md @@ -369,20 +369,7 @@ contains the example docstring to the [documentation_tests.txt](../utils/documen ### For Python files -You will first need to run the following command (from the root of the repository) to prepare the doc file (doc-testing needs to add additional lines that we don't include in the doc source files): - -```bash -python utils/prepare_for_doc_test.py src docs -``` - -If you work on a specific python module, say `modeling_wav2vec2.py`, you can run the command as follows (to avoid the unnecessary temporary changes in irrelevant files): - -```bash -python utils/prepare_for_doc_test.py src/transformers/utils/doc.py src/transformers/models/wav2vec2/modeling_wav2vec2.py -``` -(`utils/doc.py` should always be included) - -Then you can run all the tests in the docstrings of a given file with the following command, here is how we test the modeling file of Wav2Vec2 for instance: +Run all the tests in the docstrings of a given file with the following command, here is how we test the modeling file of Wav2Vec2 for instance: ```bash pytest --doctest-modules src/transformers/models/wav2vec2/modeling_wav2vec2.py -sv --doctest-continue-on-failure @@ -394,32 +381,14 @@ If you want to isolate a specific docstring, just add `::` after the file name t pytest --doctest-modules src/transformers/models/wav2vec2/modeling_wav2vec2.py::transformers.models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForCTC.forward -sv --doctest-continue-on-failure ``` -Once you're done, you can run the following command (still from the root of the repository) to undo the changes made by the first command before committing: - -```bash -python utils/prepare_for_doc_test.py src docs --remove_new_line -``` - ### For Markdown files -You will first need to run the following command (from the root of the repository) to prepare the doc file (doc-testing needs to add additional lines that we don't include in the doc source files): - -```bash -python utils/prepare_for_doc_test.py src docs -``` - -Then you can test locally a given file with this command (here testing the quicktour): +You can test locally a given file with this command (here testing the quicktour): ```bash pytest --doctest-modules docs/source/quicktour.mdx -sv --doctest-continue-on-failure --doctest-glob="*.mdx" ``` -Once you're done, you can run the following command (still from the root of the repository) to undo the changes made by the first command before committing: - -```bash -python utils/prepare_for_doc_test.py src docs --remove_new_line -``` - ### Writing doctests Here are a few tips to help you debug the doctests and make them pass: