Merge pull request #11079 from cladmi/pr/compile_and_test/bug/update_docstring

tools/compile_and_test_for_board: FIX outdated help docstring
This commit is contained in:
Alexandre Abadie 2019-03-06 16:54:42 +01:00 committed by GitHub
commit da2f4747e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 15 deletions

View File

@ -33,36 +33,44 @@ Usage
``` ```
usage: compile_and_test_for_board.py [-h] [--applications APPLICATIONS] usage: compile_and_test_for_board.py [-h] [--applications APPLICATIONS]
[--applications-exclude [--applications-exclude APPLICATIONS_EXCLUDE]
APPLICATIONS_EXCLUDE]
[--no-test] [--no-test]
[--loglevel {debug,info,warning,error, [--loglevel {debug,info,warning,error,fatal,critical}]
fatal,critical}]
[--incremental] [--clean-after] [--incremental] [--clean-after]
[--compile-targets COMPILE_TARGETS]
[--test-targets TEST_TARGETS]
[--jobs JOBS] [--jobs JOBS]
riot_directory board [result_directory] riot_directory board [result_directory]
positional arguments: positional arguments:
riot_directory RIOT directory to test riot_directory RIOT directory to test
board Board to test board Board to test
result_directory Result directory, by default "results" result_directory Result directory (default: results)
optional arguments: optional arguments:
-h, --help show this help message and exit -h, --help show this help message and exit
--applications APPLICATIONS --applications APPLICATIONS
List of applications to test, overwrites default List of applications to test, overwrites default
configuration of testing all applications configuration of testing all applications (default:
None)
--applications-exclude APPLICATIONS_EXCLUDE --applications-exclude APPLICATIONS_EXCLUDE
List of applications to exclude from tested List of applications to exclude from tested
applications. Also applied after "--applications". applications. Also applied after "--applications".
--no-test Disable executing tests (default: None)
--no-test Disable executing tests (default: False)
--loglevel {debug,info,warning,error,fatal,critical} --loglevel {debug,info,warning,error,fatal,critical}
Python logger log level, defauts to "info" Python logger log level (default: info)
--incremental Do not rerun successful compilation and tests --incremental Do not rerun successful compilation and tests
--clean-after Clean after running each test (default: False)
--clean-after Clean after running each test (default: False)
--compile-targets COMPILE_TARGETS
List of make targets to compile (default: clean all)
--test-targets TEST_TARGETS
List of make targets to run test (default: test)
--jobs JOBS, -j JOBS Parallel building (0 means not limit, like '--jobs') --jobs JOBS, -j JOBS Parallel building (0 means not limit, like '--jobs')
(default: None)
``` ```
""" """ # noqa
import os import os
import sys import sys
@ -539,7 +547,7 @@ PARSER = argparse.ArgumentParser(
PARSER.add_argument('riot_directory', help='RIOT directory to test') PARSER.add_argument('riot_directory', help='RIOT directory to test')
PARSER.add_argument('board', help='Board to test', type=_strip_board_equal) PARSER.add_argument('board', help='Board to test', type=_strip_board_equal)
PARSER.add_argument('result_directory', nargs='?', default='results', PARSER.add_argument('result_directory', nargs='?', default='results',
help='Result directory, by default "results"') help='Result directory')
PARSER.add_argument( PARSER.add_argument(
'--applications', type=list_from_string, '--applications', type=list_from_string,
help=('List of applications to test, overwrites default configuration of' help=('List of applications to test, overwrites default configuration of'
@ -553,7 +561,7 @@ PARSER.add_argument(
PARSER.add_argument('--no-test', action='store_true', default=False, PARSER.add_argument('--no-test', action='store_true', default=False,
help='Disable executing tests') help='Disable executing tests')
PARSER.add_argument('--loglevel', choices=LOG_LEVELS, default='info', PARSER.add_argument('--loglevel', choices=LOG_LEVELS, default='info',
help='Python logger log level, defauts to "info"') help='Python logger log level')
PARSER.add_argument('--incremental', action='store_true', default=False, PARSER.add_argument('--incremental', action='store_true', default=False,
help='Do not rerun successful compilation and tests') help='Do not rerun successful compilation and tests')
PARSER.add_argument('--clean-after', action='store_true', default=False, PARSER.add_argument('--clean-after', action='store_true', default=False,

View File

@ -0,0 +1,18 @@
"""Test compile_and_test_for_board script."""
import subprocess
import compile_and_test_for_board
def test_help_message():
"""Verify that the help message is in the script documentation."""
script = 'compile_and_test_for_board.py'
# Read the help message from executing the script
help_bytes = subprocess.check_output(['./%s' % script, '--help'])
help_msg = help_bytes.decode('utf-8')
docstring = compile_and_test_for_board.__doc__
assert help_msg in docstring, "Help message not in the documentation"

View File

@ -14,14 +14,14 @@ commands =
[testenv:test] [testenv:test]
deps = pytest deps = pytest
commands = commands =
pytest -v --doctest-modules {env:script} pytest -v --doctest-modules
[testenv:lint] [testenv:lint]
deps = pylint deps = pylint
commands = commands =
pylint {env:script} pylint {env:script} tests
[testenv:flake8] [testenv:flake8]
deps = flake8 deps = flake8
commands = commands =
flake8 {env:script} flake8 {env:script} tests