Revert "[Doctests] Refactor doctests + add CI" (#23245)

Revert "[Doctests] Refactor doctests + add CI (#22987)"

This reverts commit 627f44799a.
This commit is contained in:
Sylvain Gugger
2023-05-09 15:26:15 -04:00
committed by Sylvain Gugger
parent d30849f732
commit fee5b5efbe
10 changed files with 178 additions and 287 deletions

View File

@@ -212,12 +212,20 @@ Example:
```"""
```
3 steps are required to debug the docstring examples:
1. In order to properly run the test, **an extra line has to be added** at the end of the docstring. This can be automatically done on any file using:
```bash
python utils/prepare_for_doc_test.py <path_to_file_or_dir>
```
Just run the following line to automatically test every docstring example in the desired file:
2. Then, you can use the following line to automatically test every docstring example in the desired file:
```bash
pytest --doctest-modules <path_to_file_or_dir>
```
If the file has a markdown extention, you should add the `--doctest-glob="*.mdx"` argument.
3. Once you are done debugging, you need to remove the extra line added in step **1.** by running the following:
```bash
python utils/prepare_for_doc_test.py <path_to_file_or_dir> --remove_new_line
```
### Run only modified tests