From 94aeb5a2239537c07289d7d1963a17381bff13b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Thu, 28 Feb 2019 11:41:13 +0100 Subject: [PATCH 1/4] tools/compile_and_test_for_board: FIX outdated help docstring Update the help message in the docstring. It should reflect the content of `--help`. I replaced the manual line wrapping by disabling the warning on the docstring. --- .../compile_and_test_for_board.py | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/dist/tools/compile_and_test_for_board/compile_and_test_for_board.py b/dist/tools/compile_and_test_for_board/compile_and_test_for_board.py index 68f5bf1715..2924bba9f6 100755 --- a/dist/tools/compile_and_test_for_board/compile_and_test_for_board.py +++ b/dist/tools/compile_and_test_for_board/compile_and_test_for_board.py @@ -33,36 +33,46 @@ Usage ``` usage: compile_and_test_for_board.py [-h] [--applications APPLICATIONS] - [--applications-exclude - APPLICATIONS_EXCLUDE] + [--applications-exclude APPLICATIONS_EXCLUDE] [--no-test] - [--loglevel {debug,info,warning,error, - fatal,critical}] + [--loglevel {debug,info,warning,error,fatal,critical}] [--incremental] [--clean-after] + [--compile-targets COMPILE_TARGETS] + [--test-targets TEST_TARGETS] [--jobs JOBS] riot_directory board [result_directory] positional arguments: riot_directory RIOT directory to test board Board to test - result_directory Result directory, by default "results" + result_directory Result directory, by default "results" (default: + results) optional arguments: -h, --help show this help message and exit --applications APPLICATIONS List of applications to test, overwrites default - configuration of testing all applications + configuration of testing all applications (default: + None) --applications-exclude APPLICATIONS_EXCLUDE List of applications to exclude from tested 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} - Python logger log level, defauts to "info" + Python logger log level, defauts to "info" (default: + info) --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') + (default: None) ``` -""" +""" # noqa import os import sys From 998211d738f2e67e11dae6b3fcb0e6f3fb1a07e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Thu, 28 Feb 2019 13:39:27 +0100 Subject: [PATCH 2/4] tools/compile_and_test_for_board: add tests directory Tests in `tests` will be used by 'tox'. --- dist/tools/compile_and_test_for_board/tests/__init__.py | 0 dist/tools/compile_and_test_for_board/tox.ini | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 dist/tools/compile_and_test_for_board/tests/__init__.py diff --git a/dist/tools/compile_and_test_for_board/tests/__init__.py b/dist/tools/compile_and_test_for_board/tests/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/dist/tools/compile_and_test_for_board/tox.ini b/dist/tools/compile_and_test_for_board/tox.ini index b3c89b9cac..e55c7252e5 100644 --- a/dist/tools/compile_and_test_for_board/tox.ini +++ b/dist/tools/compile_and_test_for_board/tox.ini @@ -14,14 +14,14 @@ commands = [testenv:test] deps = pytest commands = - pytest -v --doctest-modules {env:script} + pytest -v --doctest-modules [testenv:lint] deps = pylint commands = - pylint {env:script} + pylint {env:script} tests [testenv:flake8] deps = flake8 commands = - flake8 {env:script} + flake8 {env:script} tests From 8c15d976298f0ff3220b84f32dcbacb2f79930c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Thu, 28 Feb 2019 13:36:00 +0100 Subject: [PATCH 3/4] tools/compile_and_test_for_board: add tests for help message Verify that the help message matches what is in the docstring. --- .../tests/test_compile_and_test_for_board.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 dist/tools/compile_and_test_for_board/tests/test_compile_and_test_for_board.py diff --git a/dist/tools/compile_and_test_for_board/tests/test_compile_and_test_for_board.py b/dist/tools/compile_and_test_for_board/tests/test_compile_and_test_for_board.py new file mode 100644 index 0000000000..5aeeb90a36 --- /dev/null +++ b/dist/tools/compile_and_test_for_board/tests/test_compile_and_test_for_board.py @@ -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" From a1d47cae21112c259e580e3a10d978ffb6b824ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Wed, 6 Mar 2019 14:47:45 +0100 Subject: [PATCH 4/4] tests/compile_and_test_for_board: remove duplicate 'default' in help Default values are given by ArgumentDefaultsHelpFormatter so no need to duplicate 'default' value in manually anymore. --- .../compile_and_test_for_board.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/dist/tools/compile_and_test_for_board/compile_and_test_for_board.py b/dist/tools/compile_and_test_for_board/compile_and_test_for_board.py index 2924bba9f6..1a48160a29 100755 --- a/dist/tools/compile_and_test_for_board/compile_and_test_for_board.py +++ b/dist/tools/compile_and_test_for_board/compile_and_test_for_board.py @@ -45,8 +45,7 @@ usage: compile_and_test_for_board.py [-h] [--applications APPLICATIONS] positional arguments: riot_directory RIOT directory to test board Board to test - result_directory Result directory, by default "results" (default: - results) + result_directory Result directory (default: results) optional arguments: -h, --help show this help message and exit @@ -60,8 +59,7 @@ optional arguments: (default: None) --no-test Disable executing tests (default: False) --loglevel {debug,info,warning,error,fatal,critical} - Python logger log level, defauts to "info" (default: - info) + Python logger log level (default: info) --incremental Do not rerun successful compilation and tests (default: False) --clean-after Clean after running each test (default: False) @@ -549,7 +547,7 @@ PARSER = argparse.ArgumentParser( 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('result_directory', nargs='?', default='results', - help='Result directory, by default "results"') + help='Result directory') PARSER.add_argument( '--applications', type=list_from_string, help=('List of applications to test, overwrites default configuration of' @@ -563,7 +561,7 @@ PARSER.add_argument( PARSER.add_argument('--no-test', action='store_true', default=False, help='Disable executing tests') 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, help='Do not rerun successful compilation and tests') PARSER.add_argument('--clean-after', action='store_true', default=False,