提交 11520c20 编写于 作者: K Kentaro Wada

Add test_labelme_1.py

上级 e02f2eed
......@@ -91,17 +91,15 @@ script:
# Run flake8
- flake8 examples labelme setup.py tests
# Run help2man
- conda install -y help2man
# Run pytest
- pytest -v tests
- labelme --help
- labelme --version
# Run help2man
- conda install -y help2man
- help2man labelme > /tmp/labelme.1
- diff docs/man/labelme.1 /tmp/labelme.1 -I '^\.TH' -I '^\.\\"' -I '^config file'
# Run examples
- (cd examples/primitives && labelme_json_to_dataset primitives.json && rm -rf primitives_json)
- (cd examples/tutorial && rm -rf apc2016_obj3_json && labelme_json_to_dataset apc2016_obj3.json && python load_label_png.py && git checkout -- .)
......
......@@ -83,6 +83,7 @@ if sys.argv[1] == 'release':
sys.exit(1)
commands = [
'python tests/docs_tests/man_tests/test_labelme.1.py',
'git tag v{:s}'.format(version),
'git push origin master --tag',
'python setup.py sdist',
......
#!/usr/bin/env python
from __future__ import print_function
import os.path as osp
import re
import shlex
import subprocess
import sys
here = osp.dirname(osp.abspath(__file__))
cmd = 'help2man labelme'
man_expected = subprocess.check_output(shlex.split(cmd)).decode().splitlines()
with open(osp.join(here, '../../../docs/man/labelme.1')) as f:
man_actual = f.read().splitlines()
patterns_exclude = [
r'^\.TH .*',
r'^config file.*',
]
FAIL = 0
for line_expected, line_actual in zip(man_expected, man_actual):
for pattern in patterns_exclude:
if re.match(pattern, line_expected) or re.match(pattern, line_actual):
break
else:
if line_expected != line_actual:
print(repr('> {}'.format(line_expected)), file=sys.stderr)
print(repr('< {}'.format(line_actual)), file=sys.stderr)
FAIL = 1
sys.exit(FAIL)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册