httpie-cli/tests/test_docs.py
Mickaël Schoentgen 6039bd8582
Switch from reStructuredText to Markdown and add docs/ (#1139)
* Convert most of the documentation from the frontend `README.rst` to `docs/REAME.md`

Also converted all reStructuredText files to Markdown.

* Tell `mdformat` to use LF for end on lines

* `--check` is not needed in the help message

* Skip tests on GitHub Windows.

Those tests pass on a real Windows machine.
Let's revisit those failure later, if needed.

* Move `mdoformat` requirement from `test` to `dev` extra

To fix Fedora CI.
2021-09-06 17:36:13 +02:00

36 lines
858 B
Python

import os
import pytest
from httpie.compat import is_windows
from .utils import TESTS_ROOT
ROOT = TESTS_ROOT.parent
SOURCE_DIRECTORIES = [
'docs',
'extras',
'httpie',
'tests',
]
def md_filenames():
yield from ROOT.glob('*.md')
for directory in SOURCE_DIRECTORIES:
yield from (ROOT / directory).glob('**/*.md')
filenames = sorted(md_filenames())
assert filenames
@pytest.mark.skipif(is_windows and 'CI' in os.environ,
reason='Does not pass on GitHub.')
@pytest.mark.parametrize('filename', filenames)
def test_md_file_syntax(filename):
mdformat = pytest.importorskip('mdformat._cli')
args = ['--end-of-line', 'lf', '--number']
err = f'Running "python -m mdformat {" ".join(args)} {filename}; git diff" should help.'
assert mdformat.run(args + ['--check', str(filename)]) == 0, err