Skip to content

Commit

Permalink
CLI updated. 0.9.23 final checkin.
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul-verma committed Apr 27, 2020
1 parent 1bb7578 commit 26ec402
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 9 deletions.
5 changes: 4 additions & 1 deletion CHANGELIST.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion arjuna/configure/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion arjuna/engine/session/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
10 changes: 5 additions & 5 deletions arjuna/interface/cli/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'")
Expand Down Expand Up @@ -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
28 changes: 27 additions & 1 deletion docs/source/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<Project Root Directory>/config/sessions.yaml` file.

.. code-block:: bash
Expand All @@ -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 `<Project Root Directory>/config/stages.yaml` file.

.. code-block:: bash
python -m arjuna run-stage -p /path/to/proj_name -s <stage_name>
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 `<Project Root Directory>/config/groups.yaml` file.

.. code-block:: bash
python -m arjuna run-group -p /path/to/proj_name -g <group_name>
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
-----------------------------------------------------------

Expand Down

0 comments on commit 26ec402

Please sign in to comment.