avocado.plugins.runners package

Submodules

avocado.plugins.runners.asset module

class avocado.plugins.runners.asset.AssetRunner

Bases: BaseRunner

Runner for dependencies of type package

This runner handles the fetch of files using the Avocado Assets utility.

Runnable attributes usage:

  • kind: ‘asset’

  • uri: not used

  • args: not used

  • kwargs:
    • name: the file name or uri (required)

    • asset_hash: hash of the file (optional)

    • algorithm: hash algorithm (optional)

    • locations: location(s) where the file can be fetched from (optional)

    • expire: time in seconds for the asset to expire (optional)

CONFIGURATION_USED = ['datadir.paths.cache_dirs']

The “main Avocado” configuration keys (AKA namespaces) that this runners makes use of.

description = 'Runner for dependencies of type package'
name = 'asset'
run(runnable)

Runner main method

Yields dictionary as output, containing status as well as relevant information concerning the results.

Parameters:

runnable (avocado.core.nrunner.Runnable) – a Runnable instance that describes what is to be run

class avocado.plugins.runners.asset.RunnerApp(echo=<built-in function print>, prog=None, description=None)

Bases: BaseRunnerApp

PROG_DESCRIPTION = 'nrunner application for dependencies of type asset'

The description of the command line application given to the command line parser

PROG_NAME = 'avocado-runner-asset'

The name of the command line application given to the command line parser

RUNNABLE_KINDS_CAPABLE = ['asset']

The names of types of runnables that this runner can handle.

avocado.plugins.runners.asset.main()

avocado.plugins.runners.avocado_instrumented module

class avocado.plugins.runners.avocado_instrumented.AvocadoInstrumentedTestRunner

Bases: BaseRunner

Runner for avocado-instrumented tests

Runnable attributes usage:

  • uri: path to a test file, combined with an Avocado.Test inherited class name and method. The test file path and class and method names should be separated by a “:”. One example of a valid uri is “mytest.py:Class.test_method”.

  • args: not used

CONFIGURATION_USED = ['run.test_parameters', 'datadir.paths.cache_dirs', 'core.show', 'job.output.loglevel', 'job.run.store_logging_stream']

The “main Avocado” configuration keys (AKA namespaces) that this runners makes use of.

description = 'Runner for avocado-instrumented tests'
name = 'avocado-instrumented'
run(runnable)

Runner main method

Yields dictionary as output, containing status as well as relevant information concerning the results.

Parameters:

runnable (avocado.core.nrunner.Runnable) – a Runnable instance that describes what is to be run

static signal_handler(signum, frame)
class avocado.plugins.runners.avocado_instrumented.RunnerApp(echo=<built-in function print>, prog=None, description=None)

Bases: BaseRunnerApp

PROG_DESCRIPTION = 'nrunner application for avocado-instrumented tests'

The description of the command line application given to the command line parser

PROG_NAME = 'avocado-runner-avocado-instrumented'

The name of the command line application given to the command line parser

RUNNABLE_KINDS_CAPABLE = ['avocado-instrumented']

The names of types of runnables that this runner can handle.

avocado.plugins.runners.avocado_instrumented.main()

avocado.plugins.runners.dry_run module

class avocado.plugins.runners.dry_run.DryRunRunner

Bases: BaseRunner

Runner for –dry-run.

It performs no action before reporting FINISHED status with cancel result.

Runnable attributes usage:

  • uri: not used

  • args: not used

description = 'Runner for --dry-run'
name = 'dry-run'
run(runnable)

Runner main method

Yields dictionary as output, containing status as well as relevant information concerning the results.

Parameters:

runnable (avocado.core.nrunner.Runnable) – a Runnable instance that describes what is to be run

class avocado.plugins.runners.dry_run.RunnerApp(echo=<built-in function print>, prog=None, description=None)

Bases: BaseRunnerApp

PROG_DESCRIPTION = 'nrunner application for dry-run tests'

The description of the command line application given to the command line parser

PROG_NAME = 'avocado-runner-dry-run'

The name of the command line application given to the command line parser

RUNNABLE_KINDS_CAPABLE = ['dry-run']

The names of types of runnables that this runner can handle.

avocado.plugins.runners.dry_run.main()

avocado.plugins.runners.exec_test module

class avocado.plugins.runners.exec_test.ExecTestRunner

Bases: BaseRunner

Runner for standalone executables treated as tests

This is similar in concept to the Avocado “SIMPLE” test type, in which an executable returning 0 means that a test passed, and anything else means that a test failed.

Runnable attributes usage:

  • uri: path to a binary to be executed as another process

  • args: arguments to be given on the command line to the binary given by path

  • kwargs: key=val to be set as environment variables to the process

CONFIGURATION_USED = ['run.keep_tmp', 'runner.exectest.exitcodes.skip', 'runner.exectest.clear_env']

The “main Avocado” configuration keys (AKA namespaces) that this runners makes use of.

description = 'Runner for standalone executables treated as tests'
name = 'exec-test'
run(runnable)

Runner main method

Yields dictionary as output, containing status as well as relevant information concerning the results.

Parameters:

runnable (avocado.core.nrunner.Runnable) – a Runnable instance that describes what is to be run

class avocado.plugins.runners.exec_test.RunnerApp(echo=<built-in function print>, prog=None, description=None)

Bases: BaseRunnerApp

PROG_DESCRIPTION = 'nrunner application for exec-test tests'

The description of the command line application given to the command line parser

PROG_NAME = 'avocado-runner-exec-test'

The name of the command line application given to the command line parser

RUNNABLE_KINDS_CAPABLE = ['exec-test']

The names of types of runnables that this runner can handle.

avocado.plugins.runners.exec_test.main()

avocado.plugins.runners.noop module

class avocado.plugins.runners.noop.NoOpRunner

Bases: BaseRunner

Sample runner that performs no action before reporting FINISHED status

Runnable attributes usage:

  • uri: not used

  • args: not used

description = 'Sample runner that performs no action before reporting FINISHED status'
name = 'noop'
run(runnable)

Runner main method

Yields dictionary as output, containing status as well as relevant information concerning the results.

Parameters:

runnable (avocado.core.nrunner.Runnable) – a Runnable instance that describes what is to be run

class avocado.plugins.runners.noop.RunnerApp(echo=<built-in function print>, prog=None, description=None)

Bases: BaseRunnerApp

PROG_DESCRIPTION = 'nrunner application for noop tests'

The description of the command line application given to the command line parser

PROG_NAME = 'avocado-runner-noop'

The name of the command line application given to the command line parser

RUNNABLE_KINDS_CAPABLE = ['noop']

The names of types of runnables that this runner can handle.

avocado.plugins.runners.noop.main()

avocado.plugins.runners.package module

class avocado.plugins.runners.package.PackageRunner

Bases: BaseRunner

Runner for dependencies of type package

This runner handles, the installation, verification and removal of packages using the avocado-software-manager.

Runnable attributes usage:

  • kind: ‘package’

  • uri: not used

  • args: not used

  • kwargs:
    • name: the package name (required)

    • action: one of ‘install’, ‘check’, or ‘remove’ (optional, defaults to ‘install’)

description = 'Runner for dependencies of type package'
name = 'package'
run(runnable)

Runner main method

Yields dictionary as output, containing status as well as relevant information concerning the results.

Parameters:

runnable (avocado.core.nrunner.Runnable) – a Runnable instance that describes what is to be run

class avocado.plugins.runners.package.RunnerApp(echo=<built-in function print>, prog=None, description=None)

Bases: BaseRunnerApp

PROG_DESCRIPTION = 'nrunner application for dependencies of type package'

The description of the command line application given to the command line parser

PROG_NAME = 'avocado-runner-package'

The name of the command line application given to the command line parser

RUNNABLE_KINDS_CAPABLE = ['package']

The names of types of runnables that this runner can handle.

avocado.plugins.runners.package.main()

avocado.plugins.runners.pip module

class avocado.plugins.runners.pip.PipRunner

Bases: BaseRunner

Runner for dependencies of type pip

This runner handles, the installation, verification and removal of packages using the pip.

Runnable attributes usage:

  • kind: ‘pip’

  • uri: not used

  • args: not used

  • kwargs:
    • name: the package name (required)

    • action: one of ‘install’ or ‘uninstall’ (optional, defaults to ‘install’)

description = 'Runner for dependencies of type pip'
name = 'pip'
run(runnable)

Runner main method

Yields dictionary as output, containing status as well as relevant information concerning the results.

Parameters:

runnable (avocado.core.nrunner.Runnable) – a Runnable instance that describes what is to be run

class avocado.plugins.runners.pip.RunnerApp(echo=<built-in function print>, prog=None, description=None)

Bases: BaseRunnerApp

PROG_DESCRIPTION = 'nrunner application for dependencies of type pip'

The description of the command line application given to the command line parser

PROG_NAME = 'avocado-runner-pip'

The name of the command line application given to the command line parser

RUNNABLE_KINDS_CAPABLE = ['pip']

The names of types of runnables that this runner can handle.

avocado.plugins.runners.pip.main()

avocado.plugins.runners.podman_image module

class avocado.plugins.runners.podman_image.PodmanImageRunner

Bases: BaseRunner

Runner for dependencies of type podman-image

This runner handles download and verification.

Runnable attributes usage:

  • kind: ‘podman-image’

  • uri: the name of the image

  • args: not used

description = 'Runner for dependencies of type podman-image'
name = 'podman-image'
run(runnable)

Runner main method

Yields dictionary as output, containing status as well as relevant information concerning the results.

Parameters:

runnable (avocado.core.nrunner.Runnable) – a Runnable instance that describes what is to be run

class avocado.plugins.runners.podman_image.RunnerApp(echo=<built-in function print>, prog=None, description=None)

Bases: BaseRunnerApp

PROG_DESCRIPTION = 'Runner for dependencies of type podman-image'

The description of the command line application given to the command line parser

PROG_NAME = 'avocado-runner-podman-image'

The name of the command line application given to the command line parser

RUNNABLE_KINDS_CAPABLE = ['podman-image']

The names of types of runnables that this runner can handle.

avocado.plugins.runners.podman_image.main()

avocado.plugins.runners.python_unittest module

class avocado.plugins.runners.python_unittest.PythonUnittestRunner

Bases: BaseRunner

Runner for Python unittests

The runnable uri is used as the test name that the native unittest TestLoader will use to find the test. A native unittest test runner (TextTestRunner) will be used to execute the test.

Runnable attributes usage:

  • uri: a single test reference, that is “a test method within a test case

    class” within a test module. Example is: “./tests/foo.py:ClassFoo.test_bar”.

  • args: not used

  • kwargs: not used

description = 'Runner for Python unittests'
property module_class_method

Return a dotted name with module + class + method.

Important to note here that module is only the module file without the full path.

property module_path

Path where the module is located.

Ex: uri = ‘./avocado.dev/selftests/.data/unittests/test.py:Class.test_foo’ It will return ‘./avocado.dev/selftests/.data/unittests/’

name = 'python-unittest'
run(runnable)

Runner main method

Yields dictionary as output, containing status as well as relevant information concerning the results.

Parameters:

runnable (avocado.core.nrunner.Runnable) – a Runnable instance that describes what is to be run

property unittest

Returns the unittest part of an uri as tuple.

Ex:

uri = ‘./avocado.dev/selftests/.data/unittests/test.py:Class.test_foo’ It will return (“test”, “Class”, “test_foo”)

class avocado.plugins.runners.python_unittest.RunnerApp(echo=<built-in function print>, prog=None, description=None)

Bases: BaseRunnerApp

PROG_DESCRIPTION = 'nrunner application for python-unittest tests'

The description of the command line application given to the command line parser

PROG_NAME = 'avocado-runner-python-unittest'

The name of the command line application given to the command line parser

RUNNABLE_KINDS_CAPABLE = ['python-unittest']

The names of types of runnables that this runner can handle.

avocado.plugins.runners.python_unittest.main()

avocado.plugins.runners.sysinfo module

class avocado.plugins.runners.sysinfo.PostSysInfo(config, sysinfo_config, queue, test_fail=False)

Bases: PreSysInfo

Log different system properties after end event.

An event may be a job, a test, or any other event with a beginning and end.

Parameters:

test_fail (bool) – flag for fail tests. Default False

sysinfo_dir = 'sysinfo/post'
class avocado.plugins.runners.sysinfo.PreSysInfo(config, sysinfo_config, queue)

Bases: object

Log different system properties before start event.

An event may be a job, a test, or any other event with a beginning and end.

Set sysinfo collectibles.

Parameters:
  • config (dict) – avocado configuration

  • sysinfo_config (dict) – dictionary with commands/tasks which should be performed during the sysinfo collection.

  • queue (multiprocessing.SimpleQueue) – queue for the runner messages

collect()

Log all collectibles at the start of the event.

property installed_pkgs
sysinfo_dir = 'sysinfo/pre'
class avocado.plugins.runners.sysinfo.RunnerApp(echo=<built-in function print>, prog=None, description=None)

Bases: BaseRunnerApp

PROG_DESCRIPTION = 'nrunner application for gathering sysinfo'

The description of the command line application given to the command line parser

PROG_NAME = 'avocado-runner-sysinfo'

The name of the command line application given to the command line parser

RUNNABLE_KINDS_CAPABLE = ['sysinfo']

The names of types of runnables that this runner can handle.

class avocado.plugins.runners.sysinfo.SysinfoRunner

Bases: BaseRunner

Runner for gathering sysinfo

Runnable attributes usage:

  • uri: sysinfo type pre/post. This variable decides if the sysinfo is

    collected before or after the test.

  • kwargs: “sysinfo” dictionary with commands/tasks which should be

    performed during the sysinfo collection.

CONFIGURATION_USED = ['sysinfo.collect.installed_packages', 'sysinfo.collect.commands_timeout', 'sysinfo.collect.locale']

The “main Avocado” configuration keys (AKA namespaces) that this runners makes use of.

description = 'Runner for gathering sysinfo'
name = 'sysinfo'
run(runnable)

Runner main method

Yields dictionary as output, containing status as well as relevant information concerning the results.

Parameters:

runnable (avocado.core.nrunner.Runnable) – a Runnable instance that describes what is to be run

avocado.plugins.runners.sysinfo.main()

avocado.plugins.runners.tap module

class avocado.plugins.runners.tap.RunnerApp(echo=<built-in function print>, prog=None, description=None)

Bases: BaseRunnerApp

PROG_DESCRIPTION = 'nrunner application for executable tests that produce TAP'

The description of the command line application given to the command line parser

PROG_NAME = 'avocado-runner-tap'

The name of the command line application given to the command line parser

RUNNABLE_KINDS_CAPABLE = ['tap']

The names of types of runnables that this runner can handle.

class avocado.plugins.runners.tap.TAPRunner

Bases: ExecTestRunner

Runner for standalone executables treated as TAP

When creating the Runnable, use the following attributes:

  • kind: should be ‘tap’;

  • uri: path to a binary to be executed as another process. This must provides a TAP output.

  • args: any runnable argument will be given on the command line to the binary given by path

  • kwargs: you can specify multiple key=val as kwargs. This will be used as environment variables to the process.

Example:

runnable = Runnable(kind=’tap’,

uri=’tests/foo.sh’, ‘bar’, # arg 1 DEBUG=’false’) # kwargs 1 (environment)

description = 'Runner for standalone executables treated as TAP'
name = 'tap'
avocado.plugins.runners.tap.main()

avocado.plugins.runners.vmimage module

class avocado.plugins.runners.vmimage.RunnerApp(echo=<built-in function print>, prog=None, description=None)

Bases: BaseRunnerApp

PROG_DESCRIPTION = 'nrunner application for dependencies of type vmimage'

The description of the command line application given to the command line parser

PROG_NAME = 'avocado-runner-vmimage'

The name of the command line application given to the command line parser

RUNNABLE_KINDS_CAPABLE = ['vmimage']

The names of types of runnables that this runner can handle.

class avocado.plugins.runners.vmimage.VMImageRunner

Bases: BaseRunner

Runner for dependencies of type vmimage. This runner uses the vmimage plugin’s download_image function which handles: 1. Checking if the image exists in cache 2. Downloading the image if not in cache 3. Storing the image in the configured cache directory 4. Returning the cached image path

description = 'Runner for dependencies of type vmimage'
name = 'vmimage'
run(runnable)

Runner main method

Yields dictionary as output, containing status as well as relevant information concerning the results.

Parameters:

runnable (avocado.core.nrunner.Runnable) – a Runnable instance that describes what is to be run

static signal_handler(signum, frame)
avocado.plugins.runners.vmimage.main()

Module contents