diff --git a/CHANGELIST.txt b/CHANGELIST.txt index ceec094b..e863f866 100644 --- a/CHANGELIST.txt +++ b/CHANGELIST.txt @@ -37,7 +37,6 @@ Current Themes (In-Progress or Planned): - Dynamic session, stage and group: - Provision for vars to create dyanmic Sessions, Stages and Groups. : -var command line switch can parameterize session for run-session, stage for run-stage, group for run-group - - -i*, -e* switches to be converted to multiple switchs with nargs. - common.yaml in Gui Namespace (fallback from page GNS.) - Report merging for HTML and XML files. - System exit code for arjuna should be based on pytest exit codes across session group threads. @@ -48,6 +47,7 @@ Current Themes (In-Progress or Planned): ------ - Test Groups - are defined groups.yaml file. + - A group can be run from the command line. - Test Stages - are defined in stages.yaml file. - use `include:` and provide list of group names. @@ -58,9 +58,12 @@ Current Themes (In-Progress or Planned): - A session can be run from command line. - CLI enhancements: - `run-stage` command added. Using it you can directly run a defined test stage. + - `run-group` command added. Using it you can directly run a defined test group. - New Named Exceptions: - UndefinedTestStageError, InvalidTestStageDefError - UndefinedTestGroupError +- CLI update + -o, -im, -em, -it, -et switches changed from plural switches expecting nargs to multi-switch method. This means these switches are single-arg switches and can be used in command line any number of times. 0.9.22 diff --git a/arjuna/configure/validator.py b/arjuna/configure/validator.py index 4c43183b..f73c46b5 100644 --- a/arjuna/configure/validator.py +++ b/arjuna/configure/validator.py @@ -204,7 +204,8 @@ def report_formats(cls, input): try: if type(input) is str: return cls.report_formats([i.upper() for i in input.split(",")]) - elif type(input) in (list, tuple): + elif type(input) in {list, tuple}: + print(input) return [ReportFormat[i.upper()] for i in input] except: cls.raise_exc(input) diff --git a/arjuna/engine/session/group.py b/arjuna/engine/session/group.py index e5a72fd2..27235693 100644 --- a/arjuna/engine/session/group.py +++ b/arjuna/engine/session/group.py @@ -153,7 +153,7 @@ def __load_meta_args(self): self.__pytest_args.extend(pytest_report_args) self.__pytest_args.extend(self.__test_args) - if self.__dry_run is not False: + if self.__dry_run not in {False, None}: print("!!!!!! This is a DRY RUN !!!!!!!") if self.__dry_run == DryRunType.SHOW_TESTS: print("Dry Run Type: SHOW TESTS") diff --git a/arjuna/interface/cli/parser.py b/arjuna/interface/cli/parser.py index 0f38b5d8..b7eec5c0 100644 --- a/arjuna/interface/cli/parser.py +++ b/arjuna/interface/cli/parser.py @@ -61,7 +61,7 @@ def __init__(self): super().__init__() self.parser = argparse.ArgumentParser(add_help=False) self.parser.add_argument("-r", "--run-id", dest="run.id", metavar="run_id", type=partial(lname_check, "Run ID"), help = 'Alnum 3-30 length. Only lower case letters.', default="mrun") - self.parser.add_argument('-o', '--output-formats', dest="report.formats", type=report_format, metavar=('F1','F2'), default=['XML', 'HTML'], nargs='+', help='One or more report format names.') # choices=['XML', 'HTML'], + self.parser.add_argument('-o', '--output-format', dest="report.formats", type=report_format, metavar='report_format', action="append", help='Output/Report format. Can pass any number of these switches.') # choices=['XML', 'HTML'], self.parser.add_argument('--update', dest="static.rid", action='store_true', help = 'Will result in overwriting of report files. Useful during script development.') self.parser.add_argument('--dry-run', dest="dry_run", metavar="dry_run_type", type=dry_run_type, help='Does a dry run. Tests are not executed. Behavior depends on the type passed as argument. SHOW_TESTS - enumerate tests. SHOW_PLAN - enumerates tests and fixtures. RUN_FIXTURES - Executes setup/teardown fixtures and emuerates tests.') self.parser.add_argument('-c', '--ref-conf', dest="ref_conf", metavar="config_name", type=str, help="Reference Configuration object name for this run. Default is 'ref'") @@ -123,12 +123,12 @@ class PickersParser(Parser): def __init__(self): super().__init__() self.parser = argparse.ArgumentParser(add_help=False) - self.parser.add_argument('-im', '--include-modules', dest="imodules", metavar=('M1','M2'), default=None, nargs='+', help='One or more names/patterns for including test modules.') - self.parser.add_argument('-em', '--exclude-modules-in-stage', dest="emodules", metavar=('M1','M2'), default=None, nargs='+', help='One or more names/patterns for excluding test modules.') + self.parser.add_argument('-im', '--include-module', dest="imodules", action="append", metavar="module_full_or_partial_name", default=None, help='Names/pattern for including test modules. Can pass any number of these switches.') + self.parser.add_argument('-em', '--exclude-module', dest="emodules", action="append", metavar="module_full_or_partial_name", default=None, help='Names/pattern for for excluding test modules. Can pass any number of these switches.') # self.parser.add_argument('-cc', '--cclasses', dest="cclasses", metavar=('C1','C2'), default=None, nargs='+', help='One or more names/patterns for considering test classes.') # self.parser.add_argument('-ic', '--iclasses', dest="iclasses", metavar=('C1','C2'), default=None, nargs='+', help='One or more names/patterns for ignoring test classes.') - self.parser.add_argument('-it', '--include-tests', dest="itests", metavar=('F1','F2'), default=None, nargs='+', help='One or more names/patterns for including test functions.') - self.parser.add_argument('-et', '--exclude-tests', dest="etests", metavar=('F1','F2'), default=None, nargs='+', help='One or more names/patterns for excluding test functions.') + self.parser.add_argument('-it', '--include-test', dest="itests", action="append", metavar="test_full_or_partial_name", default=None, help='Names/pattern for for including test functions. Can pass any number of these switches.') + self.parser.add_argument('-et', '--exclude-test', dest="etests", action="append", metavar="test_full_or_partial_name", default=None, help='Names/pattern for for excluding test functions. Can pass any number of these switches.') def process(self, arg_dict): pass \ No newline at end of file diff --git a/docs/source/cli.rst b/docs/source/cli.rst index 301319d3..dbe1725f 100644 --- a/docs/source/cli.rst +++ b/docs/source/cli.rst @@ -99,7 +99,7 @@ All the command line options specified for [the `run-project` command](#the-run- The run-session command ----------------------- -This command is used to run tests as per a session definition.yaml file. +This command is used to run tests as per a session definition in `/config/sessions.yaml` file. .. code-block:: bash @@ -109,6 +109,32 @@ All the command line options specified for [the `run-project` command](#the-run- - **-s** or **--session-name**: Name of session definition file (without .yaml extension) +The run-stage command +----------------------- + +This command is used to run tests as per a test stage definition in `/config/stages.yaml` file. + +.. code-block:: bash + + python -m arjuna run-stage -p /path/to/proj_name -s + +All the command line options specified for [the `run-project` command](#the-run-project-command) are supported. In addition, following selection related options are available: + +- **-s** or **--stage-name**: Name of a defined stage + +The run-session command +----------------------- + +This command is used to run tests as per a test group definition in `/config/groups.yaml` file. + +.. code-block:: bash + + python -m arjuna run-group -p /path/to/proj_name -g + +All the command line options specified for [the `run-project` command](#the-run-project-command) are supported. In addition, following selection related options are available: + +- **-g** or **--group-name**: Name of a define group. + Using arjuna_launcher.py Script instead of python -m arjuna -----------------------------------------------------------