| 1 |
""" |
| 2 |
This test ensures that all of redis-doc's markdown can be rendered. |
| 3 |
Why do we need this? |
| 4 |
see: |
| 5 |
https://github.com/antirez/redis-doc/commit/02b3d1a345093c1794fd86273e9d516fffd3b819 |
| 6 |
""" |
| 7 |
|
| 8 |
import pytest |
| 9 |
from importlib.resources import files |
| 10 |
|
| 11 |
from iredis.commands import commands_summary |
| 12 |
from iredis.data import commands as commands_data |
| 13 |
from iredis.markdown import render |
| 14 |
|
| 15 |
doc_files = [] |
| 16 |
for command, info in commands_summary.items(): |
| 17 |
command_docs_name = "-".join(command.split()).lower() |
| 18 |
if info["group"] == "iredis": |
| 19 |
continue |
| 20 |
doc_files.append(f"{command_docs_name}.md") |
| 21 |
|
| 22 |
|
| 23 |
@pytest.mark.parametrize("filename", doc_files) |
| 24 |
def test_markdown_render(filename): |
| 25 |
print(filename) |
| 26 |
doc = files(commands_data).joinpath(filename).read_text(encoding="utf-8") |
| 27 |
render(doc) |