httpie-cli/tests/test_docs.py

36 lines
858 B
Python
Raw Normal View History

2014-04-24 14:07:31 +02:00
import os
2014-04-24 15:17:23 +02:00
import pytest
from httpie.compat import is_windows
2014-04-24 15:17:23 +02:00
from .utils import TESTS_ROOT
2014-04-24 14:07:31 +02:00
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')
2014-04-24 14:07:31 +02:00
filenames = sorted(md_filenames())
2014-04-25 10:41:04 +02:00
assert filenames
2014-04-24 14:07:31 +02:00
2014-04-25 10:41:04 +02:00
@pytest.mark.skipif(is_windows and 'CI' in os.environ,
reason='Does not pass on GitHub.')
2014-04-25 10:41:04 +02:00
@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