Add help option for scripts

Added help options -h, --help for the script that autogenerates
the pipeline and for the one that runs the tests locally. In the
former, replaced the module optparse (which is now deprecated)
with the module argparse.

Signed-off-by: Catalin Dumitru <catdum@amazon.com>
This commit is contained in:
Catalin Dumitru
2021-08-31 14:47:47 +03:00
committed by Andreea Florescu
parent 8901e77522
commit d7ca3dc9f2
2 changed files with 42 additions and 7 deletions
+17
View File
@@ -8,6 +8,9 @@ import platform
import pathlib
import unittest
from argparse import ArgumentParser, RawTextHelpFormatter
from textwrap import dedent
PARENT_DIR = pathlib.Path(__file__).parent.resolve()
@@ -31,6 +34,20 @@ def retrieve_test_list(
if __name__ == '__main__':
help_text = dedent(
"""
This script allows running all the tests at once on the local machine.
The tests "test_benchmark.py" and "test_commit_format.py" work properly
on the local machine only when the environment variables REMOTE and
BASE_BRANCH are set. Otherwise the default values are "origin" for the
remote name of the upstream repository and "master" for the name of the
base branch, and these tests may not work as expected.
"""
)
parser = ArgumentParser(description=help_text,
formatter_class=RawTextHelpFormatter)
parser.parse_args()
test_config = retrieve_test_list()
for test in test_config['tests']:
command = test['command']