| 1 | """ |
| 2 | Test the README file. |
| 3 | |
| 4 | This is necessary because a deployment does not work if the README file |
| 5 | has errors. |
| 6 | |
| 7 | Credits: https://stackoverflow.com/a/47494076/1320237 |
| 8 | """ |
| 9 | |
| 10 | from pathlib import Path |
| 11 | |
| 12 | import restructuredtext_lint |
| 13 | |
| 14 | HERE = Path(__file__).parent |
| 15 | readme_path = Path(HERE).parent.parent / "README.rst" |
| 16 | |
| 17 | |
| 18 | def test_readme_file(): |
| 19 | """CHeck README file for errors.""" |
| 20 | messages = restructuredtext_lint.lint_file(str(readme_path)) |
| 21 | error_message = "expected to have no messages about the README file!" |
| 22 | for message in messages: |
| 23 | print(message.astext()) |
| 24 | error_message += "\n" + message.astext() |
| 25 | assert len(messages) == 0, error_message |