mirror of
https://github.com/httpie/cli.git
synced 2026-06-20 11:32:56 +02:00
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.
This commit is contained in:
1 parent
e7d8b9cece
commit
6039bd8582
16 files changed
+2436
-3157
No files matched your search
@@ -0,0 +1,3 @@
|
||||
# HTTPie Test Suite
|
||||
|
||||
Please see [CONTRIBUTING](https://github.com/httpie/httpie/blob/master/CONTRIBUTING.md) for contribution and testing guidelines.
|
||||
@@ -1,8 +0,0 @@
|
||||
HTTPie Test Suite
|
||||
=================
|
||||
|
||||
|
||||
Please see `CONTRIBUTING`_.
|
||||
|
||||
|
||||
.. _CONTRIBUTING: https://github.com/httpie/httpie/blob/master/CONTRIBUTING.rst
|
||||
+15
-49
@@ -1,69 +1,35 @@
|
||||
import os
|
||||
import subprocess
|
||||
from glob import glob
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from httpie.compat import is_windows
|
||||
|
||||
from .utils import TESTS_ROOT
|
||||
|
||||
|
||||
ROOT = TESTS_ROOT.parent
|
||||
SOURCE_DIRECTORIES = [
|
||||
'docs',
|
||||
'extras',
|
||||
'httpie',
|
||||
'tests',
|
||||
]
|
||||
|
||||
|
||||
def has_docutils():
|
||||
try:
|
||||
# noinspection PyUnresolvedReferences,PyPackageRequirements
|
||||
import docutils # noqa
|
||||
return True
|
||||
except ImportError:
|
||||
return False
|
||||
def md_filenames():
|
||||
yield from ROOT.glob('*.md')
|
||||
for directory in SOURCE_DIRECTORIES:
|
||||
yield from (ROOT / directory).glob('**/*.md')
|
||||
|
||||
|
||||
def rst_filenames():
|
||||
cwd = os.getcwd()
|
||||
os.chdir(TESTS_ROOT.parent)
|
||||
try:
|
||||
yield from glob('*.rst')
|
||||
for directory in SOURCE_DIRECTORIES:
|
||||
yield from glob(f'{directory}/**/*.rst', recursive=True)
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
|
||||
|
||||
filenames = sorted(rst_filenames())
|
||||
filenames = sorted(md_filenames())
|
||||
assert filenames
|
||||
|
||||
|
||||
# HACK: hardcoded paths, venv should be irrelevant, etc.
|
||||
# TODO: simplify by using the Python API instead of a subprocess
|
||||
# then we wont’t need the paths.
|
||||
VENV_BIN = Path(__file__).parent.parent / 'venv/bin'
|
||||
VENV_PYTHON = VENV_BIN / 'python'
|
||||
VENV_RST2PSEUDOXML = VENV_BIN / 'rst2pseudoxml.py'
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
not VENV_RST2PSEUDOXML.exists(),
|
||||
reason='docutils not installed',
|
||||
)
|
||||
@pytest.mark.skipif(is_windows and 'CI' in os.environ,
|
||||
reason='Does not pass on GitHub.')
|
||||
@pytest.mark.parametrize('filename', filenames)
|
||||
def test_rst_file_syntax(filename):
|
||||
p = subprocess.Popen(
|
||||
[
|
||||
VENV_PYTHON,
|
||||
VENV_RST2PSEUDOXML,
|
||||
'--report=1',
|
||||
'--exit-status=1',
|
||||
filename,
|
||||
],
|
||||
stderr=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
shell=True,
|
||||
)
|
||||
err = p.communicate()[1]
|
||||
assert p.returncode == 0, err.decode()
|
||||
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
|
||||
Reference in new issue
Block a user