2014-04-24 14:07:31 +02:00
|
|
|
import os
|
|
|
|
|
2014-04-24 15:17:23 +02:00
|
|
|
import pytest
|
2021-09-06 17:36:13 +02:00
|
|
|
from httpie.compat import is_windows
|
2014-04-24 15:17:23 +02:00
|
|
|
|
2021-05-05 14:13:39 +02:00
|
|
|
from .utils import TESTS_ROOT
|
2014-04-24 14:07:31 +02:00
|
|
|
|
|
|
|
|
2021-09-06 17:36:13 +02:00
|
|
|
ROOT = TESTS_ROOT.parent
|
2019-12-04 13:51:45 +01:00
|
|
|
SOURCE_DIRECTORIES = [
|
2021-09-06 17:36:13 +02:00
|
|
|
'docs',
|
2019-12-04 13:51:45 +01:00
|
|
|
'extras',
|
|
|
|
'httpie',
|
|
|
|
'tests',
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2021-09-06 17:36:13 +02:00
|
|
|
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
|
|
|
|
|
|
|
|
2021-09-06 17:36:13 +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
|
|
|
|
2021-09-06 17:36:13 +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)
|
2021-09-06 17:36:13 +02:00
|
|
|
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
|