catcher.core package

Submodules

catcher.core.runner module

class catcher.core.runner.Runner(path: str, tests_path: str, inventory: str, modules=None, cmd_env=None, system_environment=None, resources=None, output_format=None, filter_list=None)[source]

Bases: object

run_tests(output: str = 'full') → bool[source]

Run the testcase :param output: ‘full’ - all output possible. ‘limited’ - only test end report & summary. ‘final’ - only summary.

catcher.core.test module

class catcher.core.test.Test(path: str, file: str, includes: dict = None, variables: dict = None, config: dict = None, steps: list = None, final: list = None, ignore: Union[bool, str, dict] = None)[source]

Bases: object

Testcase. Contains variables, includes, steps and final actions.

Ignore:if true will ignore this test. A condition based on catcher.steps.check.Check() can be used to compute ignore condition dynamically.
Include:other test to run. See catcher.core.include.Include(). Can be a string in case of single include or a list of include in case of multiple. Each of them will be run before the test passing variables to each other and, finally, to the test. In case of run_on_include include’s property is false or as alias is set include won’t be run before the test. You can run such include via catcher.steps.run.Run() step later. See Includes for more info.
Variables:test local variables which override inventory variables. These variables will be available only in this test or in test which includes this test. Variables itself can contain templates. See Variables for more info.
Steps:A list of test actions which will be run one by one. They can use variables and support templates. Each step can register it’s output as a new variable. See catcher.steps.step.Step() for available options. See internal_modules and external modules for more info.
Finally:A list of clean up actions which will be run after test finishes execution. Condition for every clean up action run can be set (by default they run in any case).

See How to write a test cheat sheet for more info and examples.

check_ignored()[source]
run(tag=None, raise_stop=False) → dict[source]
run_finally(result: bool)[source]
catcher.core.test.get_action_name(action_type: str, action: catcher.steps.step.Step, variables: dict)[source]
catcher.core.test.get_or_default(key: str, body: dict, default: any) → any[source]
catcher.core.test.get_timing(start_time) → str[source]

catcher.core.include module

class catcher.core.include.Include(ignore_errors=False, file=None, **kwargs)[source]

Bases: object

Include another testcase in include section:

  • file: test file to include
  • variables: variables to override
  • alias: unique name to run this test later
  • run_on_include: should run as soon as included (before test)
  • ignore_errors: should continue running other tests if this fails
Examples:

Simple include - will run before test

include: register_user.yaml

Will run before test with some variables overridden

include:
    file: register_user.yaml
    variables:
        user_email: 'override@email.org'

Multiple includes. Will run one by one. Variables from the first one will be passed to the next

include:
    - simple_form.yaml
    - file: long_form.yaml
      variables: {user_email: 'override@email.org'}

Include with alias and run later

include:
    file: register_user.yaml
    as: sign_up
steps:
    # .... some steps
    - run:
        include: sign_up
    # .... some steps

See includes for more info.

static check_circular(parent: str, all_includes: networkx.classes.digraph.DiGraph, current_include: dict) → catcher.core.include.Include[source]
static path_from_root(include_file: str, path: str) → dict[source]
static read_include(path=None, parent=None, include_file=None, all_includes=None)[source]
static read_includes(path: str, parent: str, includes: Union[dict, list, str], all_includes: Optional[networkx.classes.digraph.DiGraph]) → Tuple[networkx.classes.digraph.DiGraph, List[catcher.core.include.Include]][source]

catcher.core.step_factory module

members:
undoc-members:
show-inheritance:
 

Module contents