Extension (plugin) APIs¶
Extension APIs that may be of interest to plugin writers.
Subpackages¶
- avocado.plugins.runners package
- Submodules
- avocado.plugins.runners.asset module
- avocado.plugins.runners.avocado_instrumented module
- avocado.plugins.runners.dry_run module
- avocado.plugins.runners.exec_test module
- avocado.plugins.runners.noop module
- avocado.plugins.runners.package module
- avocado.plugins.runners.podman_image module
- avocado.plugins.runners.python_unittest module
- avocado.plugins.runners.sysinfo module
- avocado.plugins.runners.tap module
- Module contents
- avocado.plugins.spawners package
Submodules¶
avocado.plugins.archive module¶
Result Archive Plugin
-
class
avocado.plugins.archive.
Archive
¶ Bases:
avocado.core.plugin_interfaces.Result
-
description
= 'Result archive (ZIP) support'¶
-
name
= 'zip_archive'¶
-
render
(result, job)¶ Entry point with method that renders the result.
This will usually be used to write the result to a file or directory.
Parameters: - result (
avocado.core.result.Result
) – the complete job result - job (
avocado.core.job.Job
) – the finished job for which a result will be written
- result (
-
-
class
avocado.plugins.archive.
ArchiveCLI
¶ Bases:
avocado.core.plugin_interfaces.CLI
-
configure
(parser)¶ Configures the command line parser with options specific to this plugin.
-
description
= 'Result archive (ZIP) support to run command'¶
-
name
= 'zip_archive'¶
-
run
(config)¶ Execute any action the plugin intends.
Example of action may include activating a special features upon finding that the requested command line options were set by the user.
Note: this plugin class is not intended for adding new commands, for that please use CLICmd.
-
avocado.plugins.assets module¶
Assets subcommand
-
class
avocado.plugins.assets.
Assets
¶ Bases:
avocado.core.plugin_interfaces.CLICmd
Implements the avocado ‘assets’ subcommand
-
configure
(parser)¶ Add the subparser for the assets action.
Parameters: parser ( avocado.core.parser.ArgumentParser
) – The Avocado command line application parser
-
description
= 'Manage assets'¶
-
static
handle_fetch
(config)¶
-
handle_list
(config)¶
-
handle_purge
(config)¶
-
static
handle_register
(config)¶
-
name
= 'assets'¶
-
run
(config)¶ Entry point for actually running the command.
-
-
class
avocado.plugins.assets.
FetchAssetHandler
(file_name, klass=None, method=None)¶ Bases:
ast.NodeVisitor
Handles the parsing of instrumented tests for fetch_asset statements.
-
PATTERN
= 'fetch_asset'¶
-
visit_Assign
(node)¶ Visit Assign on AST and build assignments.
This method will visit and build list of assignments that matches the pattern pattern name = string.
Parameters: node (ast.*) – AST node to be evaluated
-
visit_Call
(node)¶ Visit Calls on AST and build list of calls that matches the pattern.
Parameters: node (ast.*) – AST node to be evaluated
-
visit_ClassDef
(node)¶ Visit ClassDef on AST and save current Class.
Parameters: node (ast.*) – AST node to be evaluated
-
visit_FunctionDef
(node)¶ Visit FunctionDef on AST and save current method.
Parameters: node (ast.*) – AST node to be evaluated
-
-
class
avocado.plugins.assets.
FetchAssetJob
(config=None)¶ Bases:
avocado.core.plugin_interfaces.JobPreTests
Implements the assets fetch job pre tests.
This has the same effect of running the ‘avocado assets fetch INSTRUMENTED’, but it runs during the test execution, before the actual test starts.
-
description
= 'Fetch assets before the test run'¶
-
name
= 'fetchasset'¶
-
pre_tests
(job)¶ Entry point for job running actions before tests execution.
-
-
avocado.plugins.assets.
fetch_assets
(test_file, klass=None, method=None, logger=None)¶ Fetches the assets based on keywords listed on FetchAssetHandler.calls.
Parameters: test_file – File name of instrumented test to be evaluated :type test_file: str Returns: list of names that were successfully fetched and list of fails.
avocado.plugins.beaker_result module¶
beaker result plugin
Sends results and logs to beaker using the harness API. https://beaker-project.org/docs/alternative-harnesses/index.html
Finds the beaker API entry point using the BEAKER_LAB_CONTROLLER_URL environment variable. Does nothing in case the variable is not set.
-
class
avocado.plugins.beaker_result.
BeakerResult
(config=None)¶ Bases:
avocado.core.plugin_interfaces.ResultEvents
send test results to beaker test harness api
-
beaker_url
= None¶
-
description
= 'report results to beaker'¶
-
end_test
(result, state)¶ Event triggered when a test finishes running.
-
job_id
= None¶
-
name
= 'beaker'¶
-
post_result
(state)¶
-
post_tests
(job)¶ Entry point for job running actions after the tests execution.
-
pre_tests
(job)¶ Entry point for job running actions before tests execution.
-
put_data
(location, name, content)¶
-
put_file
(location, name, filename)¶
-
put_file_list
(location, prefix, filelist)¶
-
send_request
(req)¶
-
start_test
(result, state)¶ Event triggered when a test starts running.
-
test_progress
(progress=False)¶ Interface to notify progress (or not) of the running test.
-
avocado.plugins.bystatus module¶
-
class
avocado.plugins.bystatus.
ByStatusLink
(config)¶ Bases:
avocado.core.plugin_interfaces.ResultEvents
-
description
= 'Creates symlinks on file system grouped by status'¶
-
end_test
(result, state)¶ Event triggered when a test finishes running.
-
post_tests
(job)¶ Entry point for job running actions after the tests execution.
-
pre_tests
(job)¶ Entry point for job running actions before tests execution.
-
start_test
(result, state)¶ Event triggered when a test starts running.
-
test_progress
(progress=False)¶ Interface to notify progress (or not) of the running test.
-
avocado.plugins.cache module¶
-
class
avocado.plugins.cache.
Cache
¶ Bases:
avocado.core.plugin_interfaces.CLICmd
Implements the avocado ‘cache’ subcommand
-
configure
(parser)¶ Add the subparser for the cache action.
Parameters: parser ( avocado.core.parser.ArgumentParser
) – The Avocado command line application parser
-
description
= 'Interface for manipulating the Avocado cache metadata'¶
-
name
= 'cache'¶
-
run
(config)¶ Entry point for actually running the command.
-
avocado.plugins.config module¶
-
class
avocado.plugins.config.
Config
¶ Bases:
avocado.core.plugin_interfaces.CLICmd
Implements the avocado ‘config’ subcommand
-
configure
(parser)¶ Lets the extension add command line options and do early configuration.
By default it will register its name as the command name and give its description as the help message.
-
description
= 'Shows avocado config keys'¶
-
static
handle_default
()¶
-
static
handle_reference
(print_function)¶
-
name
= 'config'¶
-
run
(config)¶ Entry point for actually running the command.
-
avocado.plugins.dependency module¶
-
class
avocado.plugins.dependency.
DependencyResolver
¶ Bases:
avocado.core.plugin_interfaces.PreTest
Implements the dependency pre tests plugin.
It will create pre-test tasks for managing dependencies based on the :avocado: dependency= definition inside the test’s docstring.
-
description
= 'Dependency resolver for tests with dependencies'¶
-
is_cacheable
= True¶
-
name
= 'dependency'¶
-
static
pre_test_runnables
(test_runnable, suite_config=None)¶ Entry point for creating runnables, which will be run before test.
Parameters: - test_runnable – Runnable of the Test itself.
- suite_config – Configuration dict relevant for the whole suite.
Returns: PreTest task runnables created by plugin.
Return type: list of
avocado.core.nrunner.Runnable
-
avocado.plugins.dict_variants module¶
-
class
avocado.plugins.dict_variants.
DictVariants
¶ Bases:
avocado.core.plugin_interfaces.Varianter
Turns (a list of) Python dictionaries into variants
-
description
= 'Python Dictionary based varianter'¶
-
initialize
(config)¶
-
name
= 'dict_variants'¶
-
to_str
(summary, variants, **kwargs)¶ Return human readable representation
The summary/variants accepts verbosity where 0 means silent and maximum is up to the plugin.
Parameters: - summary – How verbose summary to output (int)
- variants – How verbose list of variants to output (int)
- kwargs – Other free-form arguments
Return type:
-
-
class
avocado.plugins.dict_variants.
DictVariantsInit
¶ Bases:
avocado.core.plugin_interfaces.Init
-
description
= 'Python Dictionary based varianter'¶
-
initialize
()¶ Entry point for the plugin to perform its initialization.
-
name
= 'dict_variants'¶
-
avocado.plugins.diff module¶
Job Diff
-
class
avocado.plugins.diff.
Diff
¶ Bases:
avocado.core.plugin_interfaces.CLICmd
Implements the avocado ‘diff’ subcommand
-
configure
(parser)¶ Add the subparser for the diff action.
Parameters: parser ( avocado.core.parser.ArgumentParser
) – The Avocado command line application parser
-
description
= 'Shows the difference between 2 jobs.'¶
-
name
= 'diff'¶
-
run
(config)¶ Entry point for actually running the command.
-
avocado.plugins.distro module¶
-
avocado.plugins.distro.
DISTRO_PKG_INFO_LOADERS
= {'deb': <class 'avocado.plugins.distro.DistroPkgInfoLoaderDeb'>, 'rpm': <class 'avocado.plugins.distro.DistroPkgInfoLoaderRpm'>}¶ the type of distro that will determine what loader will be used
-
class
avocado.plugins.distro.
Distro
¶ Bases:
avocado.core.plugin_interfaces.CLICmd
Implements the avocado ‘distro’ subcommand
-
configure
(parser)¶ Lets the extension add command line options and do early configuration.
By default it will register its name as the command name and give its description as the help message.
-
description
= 'Shows detected Linux distribution'¶
-
name
= 'distro'¶
-
run
(config)¶ Entry point for actually running the command.
-
-
class
avocado.plugins.distro.
DistroDef
(name, version, release, arch)¶ Bases:
avocado.utils.distro.LinuxDistro
More complete information on a given Linux Distribution
Can and should include all the software packages that ship with the distro, so that an analysis can be made on whether a given package that may be responsible for a regression is part of the official set or an external package.
-
software_packages
= None¶ All the software packages that ship with this Linux distro
-
software_packages_type
= None¶ A simple text that denotes the software type that makes this distro
-
to_dict
()¶ Returns the representation as a dictionary
-
to_json
()¶ Returns the representation of the distro as JSON
-
-
class
avocado.plugins.distro.
DistroPkgInfoLoader
(path)¶ Bases:
object
Loads information from the distro installation tree into a DistroDef
It will go through all package files and inspect them with specific package utilities, collecting the necessary information.
-
get_package_info
(path)¶ Returns information about a given software package
Should be implemented by classes inheriting from
DistroDefinitionLoader
.Parameters: path (str) – path to the software package file Returns: tuple with name, version, release, checksum and arch Return type: tuple
-
get_packages_info
()¶ This method will go through each file, checking if it’s a valid software package file by calling
is_software_package()
and callingload_package_info()
if it’s so.
-
is_software_package
(path)¶ Determines if the given file at path is a software package
This check will be used to determine if
load_package_info()
will be called for file at path. This method should be implemented by classes inheriting fromDistroPkgInfoLoader
and could be as simple as checking for a file suffix.Parameters: path (str) – path to the software package file Returns: either True if the file is a valid software package or False otherwise Return type: bool
-
-
class
avocado.plugins.distro.
DistroPkgInfoLoaderDeb
(path)¶ Bases:
avocado.plugins.distro.DistroPkgInfoLoader
Loads package information for DEB files
-
get_package_info
(path)¶ Returns information about a given software package
Should be implemented by classes inheriting from
DistroDefinitionLoader
.Parameters: path (str) – path to the software package file Returns: tuple with name, version, release, checksum and arch Return type: tuple
-
is_software_package
(path)¶ Determines if the given file at path is a software package
This check will be used to determine if
load_package_info()
will be called for file at path. This method should be implemented by classes inheriting fromDistroPkgInfoLoader
and could be as simple as checking for a file suffix.Parameters: path (str) – path to the software package file Returns: either True if the file is a valid software package or False otherwise Return type: bool
-
-
class
avocado.plugins.distro.
DistroPkgInfoLoaderRpm
(path)¶ Bases:
avocado.plugins.distro.DistroPkgInfoLoader
Loads package information for RPM files
-
get_package_info
(path)¶ Returns information about a given software package
Should be implemented by classes inheriting from
DistroDefinitionLoader
.Parameters: path (str) – path to the software package file Returns: tuple with name, version, release, checksum and arch Return type: tuple
-
is_software_package
(path)¶ Systems needs to be able to run the rpm binary in order to fetch information on package files. If the rpm binary is not available on this system, we simply ignore the rpm files found
-
-
class
avocado.plugins.distro.
SoftwarePackage
(name, version, release, checksum, arch)¶ Bases:
object
Definition of relevant information on a software package
-
to_dict
()¶ Returns the representation as a dictionary
-
to_json
()¶ Returns the representation of the distro as JSON
-
-
avocado.plugins.distro.
load_distro
(path)¶ Loads the distro from an external file
Parameters: path (str) – the location for the input file Returns: a dict with the distro definition data Return type: dict
-
avocado.plugins.distro.
load_from_tree
(name, version, release, arch, package_type, path)¶ Loads a DistroDef from an installable tree
Parameters: - name (str) – a short name that precisely distinguishes this Linux Distribution among all others.
- version (str) – the major version of the distribution. Usually this is a single number that denotes a large development cycle and support file.
- release (str) – the release or minor version of the distribution. Usually this is also a single number, that is often omitted or starts with a 0 when the major version is initially release. It’s often associated with a shorter development cycle that contains incremental a collection of improvements and fixes.
- arch (str) – the main target for this Linux Distribution. It’s common for some architectures to ship with packages for previous and still compatible architectures, such as it’s the case with Intel/AMD 64 bit architecture that support 32 bit code. In cases like this, this should be set to the 64 bit architecture name.
- package_type (str) – one of the available package info loader types
- path (str) – top level directory of the distro installation tree files
avocado.plugins.exec_path module¶
Libexec PATHs modifier
-
class
avocado.plugins.exec_path.
ExecPath
¶ Bases:
avocado.core.plugin_interfaces.CLICmd
Implements the avocado ‘exec-path’ subcommand
-
description
= 'Returns path to avocado bash libraries and exits.'¶
-
name
= 'exec-path'¶
-
run
(config)¶ Print libexec path and finish
Parameters: config – job configuration
-
avocado.plugins.human module¶
Human result UI
-
avocado.plugins.human.
COMPLETE_STATUSES
= ['SKIP', 'ERROR', 'FAIL', 'WARN', 'PASS', 'INTERRUPTED', 'CANCEL', 'STARTED']¶ STATUSES contains the finished status, but lacks the novel concept of nrunner having tests STARTED (that is, in progress). This contains a more complete list of statuses that includes “STARTED”
-
class
avocado.plugins.human.
Human
(config)¶ Bases:
avocado.core.plugin_interfaces.ResultEvents
Human result UI
-
description
= 'Human Interface UI'¶
-
end_test
(result, state)¶ Event triggered when a test finishes running.
-
static
get_colored_status
(status, extra=None)¶
-
name
= 'human'¶
-
post_tests
(job)¶ Entry point for job running actions after the tests execution.
-
pre_tests
(job)¶ Entry point for job running actions before tests execution.
-
start_test
(result, state)¶ Event triggered when a test starts running.
-
test_progress
(progress=False)¶ Interface to notify progress (or not) of the running test.
-
-
class
avocado.plugins.human.
HumanInit
¶ Bases:
avocado.core.plugin_interfaces.Init
-
description
= 'Initialize human ui plugin settings'¶
-
initialize
()¶ Entry point for the plugin to perform its initialization.
-
-
class
avocado.plugins.human.
HumanJob
¶ Bases:
avocado.core.plugin_interfaces.JobPre
,avocado.core.plugin_interfaces.JobPost
Human result UI
-
description
= 'Human Interface UI'¶
-
name
= 'human'¶
-
post
(job)¶ Entry point for actually running the post job action.
-
pre
(job)¶ Entry point for actually running the pre job action.
-
avocado.plugins.jobs module¶
Jobs subcommand
-
class
avocado.plugins.jobs.
Jobs
¶ Bases:
avocado.core.plugin_interfaces.CLICmd
Implements the avocado ‘jobs’ subcommand
-
configure
(parser)¶ Add the subparser for the assets action.
Parameters: parser ( avocado.core.parser.ArgumentParser
) – The Avocado command line application parser
-
description
= 'Manage Avocado jobs'¶
-
static
handle_list_command
(jobs_results)¶ Called when ‘avocado jobs list’ command is executed.
-
handle_show_command
(config)¶ Called when ‘avocado jobs show’ command is executed.
-
name
= 'jobs'¶
-
run
(config)¶ Entry point for actually running the command.
-
avocado.plugins.jobscripts module¶
-
class
avocado.plugins.jobscripts.
JobScripts
¶ Bases:
avocado.core.plugin_interfaces.JobPre
,avocado.core.plugin_interfaces.JobPost
-
description
= 'Runs scripts before/after the job is run'¶
-
name
= 'jobscripts'¶
-
post
(job)¶ Entry point for actually running the post job action.
-
pre
(job)¶ Entry point for actually running the pre job action.
-
-
class
avocado.plugins.jobscripts.
JobScriptsInit
¶ Bases:
avocado.core.plugin_interfaces.Init
-
description
= 'Jobscripts plugin initialization'¶
-
initialize
()¶ Entry point for the plugin to perform its initialization.
-
name
= 'jobscripts-init'¶
-
avocado.plugins.journal module¶
Journal Plugin
-
class
avocado.plugins.journal.
Journal
¶ Bases:
avocado.core.plugin_interfaces.CLI
Test journal
-
configure
(parser)¶ Configures the command line parser with options specific to this plugin.
-
description
= "Journal options for the 'run' subcommand"¶
-
name
= 'journal'¶
-
run
(config)¶ Execute any action the plugin intends.
Example of action may include activating a special features upon finding that the requested command line options were set by the user.
Note: this plugin class is not intended for adding new commands, for that please use CLICmd.
-
-
class
avocado.plugins.journal.
JournalResult
(config)¶ Bases:
avocado.core.plugin_interfaces.ResultEvents
Test Result Journal class.
This class keeps a log of the test updates: started running, finished, etc. This information can be forwarded live to an avocado server and provide feedback to users from a central place.
Creates an instance of ResultJournal.
Parameters: job – an instance of avocado.core.job.Job
.-
description
= 'Journal event based results implementation'¶
-
end_test
(result, state)¶ Event triggered when a test finishes running.
-
lazy_init_journal
(state)¶
-
name
= 'journal'¶
-
post_tests
(job)¶ Entry point for job running actions after the tests execution.
-
pre_tests
(job)¶ Entry point for job running actions before tests execution.
-
start_test
(result, state)¶ Event triggered when a test starts running.
-
test_progress
(progress=False)¶ Interface to notify progress (or not) of the running test.
-
avocado.plugins.json_variants module¶
-
class
avocado.plugins.json_variants.
JsonVariants
¶ Bases:
avocado.core.plugin_interfaces.Varianter
Processes the serialized file into variants
-
description
= 'JSON serialized based Varianter'¶
-
initialize
(config)¶
-
name
= 'json variants'¶
-
to_str
(summary, variants, **kwargs)¶ Return human readable representation
The summary/variants accepts verbosity where 0 means silent and maximum is up to the plugin.
Parameters: - summary – How verbose summary to output (int)
- variants – How verbose list of variants to output (int)
- kwargs – Other free-form arguments
Return type:
-
variants
= None¶
-
-
class
avocado.plugins.json_variants.
JsonVariantsCLI
¶ Bases:
avocado.core.plugin_interfaces.CLI
Serialized based Varianter options
-
configure
(parser)¶ Configures the command line parser with options specific to this plugin.
-
description
= "JSON serialized based Varianter options for the 'run' subcommand"¶
-
name
= 'json variants'¶
-
run
(config)¶ Execute any action the plugin intends.
Example of action may include activating a special features upon finding that the requested command line options were set by the user.
Note: this plugin class is not intended for adding new commands, for that please use CLICmd.
-
-
class
avocado.plugins.json_variants.
JsonVariantsInit
¶ Bases:
avocado.core.plugin_interfaces.Init
-
description
= 'JSON serialized based varianter initialization'¶
-
initialize
()¶ Entry point for the plugin to perform its initialization.
-
name
= 'json_variants'¶
-
avocado.plugins.jsonresult module¶
JSON output module.
-
class
avocado.plugins.jsonresult.
JSONCLI
¶ Bases:
avocado.core.plugin_interfaces.CLI
JSON output
-
configure
(parser)¶ Configures the command line parser with options specific to this plugin.
-
description
= "JSON output options for 'run' command"¶
-
name
= 'json'¶
-
run
(config)¶ Execute any action the plugin intends.
Example of action may include activating a special features upon finding that the requested command line options were set by the user.
Note: this plugin class is not intended for adding new commands, for that please use CLICmd.
-
-
class
avocado.plugins.jsonresult.
JSONInit
¶ Bases:
avocado.core.plugin_interfaces.Init
-
description
= 'JSON job result plugin initialization'¶
-
initialize
()¶ Entry point for the plugin to perform its initialization.
-
name
= 'json'¶
-
-
class
avocado.plugins.jsonresult.
JSONResult
¶ Bases:
avocado.core.plugin_interfaces.Result
-
description
= 'JSON result support'¶
-
name
= 'json'¶
-
render
(result, job)¶ Entry point with method that renders the result.
This will usually be used to write the result to a file or directory.
Parameters: - result (
avocado.core.result.Result
) – the complete job result - job (
avocado.core.job.Job
) – the finished job for which a result will be written
- result (
-
avocado.plugins.list module¶
-
class
avocado.plugins.list.
List
¶ Bases:
avocado.core.plugin_interfaces.CLICmd
Implements the avocado ‘list’ subcommand
-
configure
(parser)¶ Add the subparser for the list action.
Parameters: parser ( avocado.core.parser.ArgumentParser
) – The Avocado command line application parser
-
description
= 'List available tests'¶
-
name
= 'list'¶
-
run
(config)¶ Entry point for actually running the command.
-
static
save_recipes
(suite, directory, matrix_len)¶
-
avocado.plugins.plugins module¶
Plugins information plugin
-
class
avocado.plugins.plugins.
Plugins
¶ Bases:
avocado.core.plugin_interfaces.CLICmd
Plugins information
-
configure
(parser)¶ Lets the extension add command line options and do early configuration.
By default it will register its name as the command name and give its description as the help message.
-
description
= 'Displays plugin information'¶
-
name
= 'plugins'¶
-
run
(config)¶ Entry point for actually running the command.
-
avocado.plugins.replay module¶
Replay Job Plugin
-
class
avocado.plugins.replay.
Replay
¶ Bases:
avocado.core.plugin_interfaces.CLICmd
Implements the avocado ‘replay’ subcommand.
-
configure
(parser)¶ Lets the extension add command line options and do early configuration.
By default it will register its name as the command name and give its description as the help message.
-
description
= 'Runs a new job using a previous job as its configuration'¶
-
name
= 'replay'¶
-
run
(config)¶ Entry point for actually running the command.
-
avocado.plugins.requirement_cache module¶
-
class
avocado.plugins.requirement_cache.
RequirementCache
¶ Bases:
avocado.core.plugin_interfaces.Cache
-
clear
()¶ Clear all cache entries
It removes every cache entire.
-
description
= 'Provides requirement cache entries'¶
-
list
()¶ List all cache entries
Creates list of cache entries which represents current cache state.
Returns: Human-readable list of entries which will be printed to console. Return type: str
-
name
= 'requirement'¶
-
avocado.plugins.resolvers module¶
Test resolver for builtin test types
-
class
avocado.plugins.resolvers.
AvocadoInstrumentedResolver
(config=None)¶ Bases:
avocado.core.plugin_interfaces.Resolver
-
description
= 'Test resolver for Avocado Instrumented tests'¶
-
name
= 'avocado-instrumented'¶
-
priority
= 70¶
-
resolve
(reference)¶ Resolves the given reference into a reference resolution.
Parameters: reference (str) – a specification that can eventually be resolved into a test (in the form of a avocado.core.nrunner.Runnable
)Returns: the result of the resolution process, containing the success, failure or error, along with zero or more avocado.core.nrunner.Runnable
objectsReturn type: avocado.core.resolver.ReferenceResolution
-
-
class
avocado.plugins.resolvers.
ExecTestResolver
(config=None)¶ Bases:
avocado.core.plugin_interfaces.Resolver
-
description
= 'Test resolver for executable files to be handled as tests'¶
-
name
= 'exec-test'¶
-
priority
= 1¶
-
resolve
(reference)¶ Resolves the given reference into a reference resolution.
Parameters: reference (str) – a specification that can eventually be resolved into a test (in the form of a avocado.core.nrunner.Runnable
)Returns: the result of the resolution process, containing the success, failure or error, along with zero or more avocado.core.nrunner.Runnable
objectsReturn type: avocado.core.resolver.ReferenceResolution
-
-
class
avocado.plugins.resolvers.
PythonUnittestResolver
(config=None)¶ Bases:
avocado.core.plugin_interfaces.Resolver
-
description
= 'Test resolver for Python Unittests'¶
-
name
= 'python-unittest'¶
-
resolve
(reference)¶ Resolves the given reference into a reference resolution.
Parameters: reference (str) – a specification that can eventually be resolved into a test (in the form of a avocado.core.nrunner.Runnable
)Returns: the result of the resolution process, containing the success, failure or error, along with zero or more avocado.core.nrunner.Runnable
objectsReturn type: avocado.core.resolver.ReferenceResolution
-
-
class
avocado.plugins.resolvers.
TapResolver
(config=None)¶ Bases:
avocado.core.plugin_interfaces.Resolver
-
description
= 'Test resolver for executable files to be handled as TAP tests'¶
-
name
= 'tap'¶
-
priority
= 0¶
-
resolve
(reference)¶ Resolves the given reference into a reference resolution.
Parameters: reference (str) – a specification that can eventually be resolved into a test (in the form of a avocado.core.nrunner.Runnable
)Returns: the result of the resolution process, containing the success, failure or error, along with zero or more avocado.core.nrunner.Runnable
objectsReturn type: avocado.core.resolver.ReferenceResolution
-
-
avocado.plugins.resolvers.
python_resolver
(name, reference, find_tests)¶
avocado.plugins.run module¶
Base Test Runner Plugins.
-
class
avocado.plugins.run.
Run
¶ Bases:
avocado.core.plugin_interfaces.CLICmd
Implements the avocado ‘run’ subcommand
-
configure
(parser)¶ Add the subparser for the run action.
Parameters: parser – Main test runner parser.
-
description
= 'Runs one or more tests (native test, test alias, binary or script)'¶
-
name
= 'run'¶
-
-
class
avocado.plugins.run.
RunInit
¶ Bases:
avocado.core.plugin_interfaces.Init
-
description
= 'Initializes the run options'¶
-
initialize
()¶ Entry point for the plugin to perform its initialization.
-
name
= 'run'¶
-
avocado.plugins.runner_nrunner module¶
NRunner based implementation of job compliant runner
-
class
avocado.plugins.runner_nrunner.
Runner
¶ Bases:
avocado.core.plugin_interfaces.SuiteRunner
-
description
= 'nrunner based implementation of job compliant runner'¶
-
name
= 'nrunner'¶
-
run_suite
(job, test_suite)¶ Run one or more tests and report with test result.
Parameters: - job – an instance of
avocado.core.job.Job
. - test_suite – an instance of TestSuite with some tests to run.
Returns: a set with types of test failures.
- job – an instance of
-
-
class
avocado.plugins.runner_nrunner.
RunnerCLI
¶ Bases:
avocado.core.plugin_interfaces.CLI
-
configure
(parser)¶ Configures the command line parser with options specific to this plugin.
-
description
= 'nrunner command line options for "run"'¶
-
name
= 'nrunner'¶
-
run
(config)¶ Execute any action the plugin intends.
Example of action may include activating a special features upon finding that the requested command line options were set by the user.
Note: this plugin class is not intended for adding new commands, for that please use CLICmd.
-
-
class
avocado.plugins.runner_nrunner.
RunnerInit
¶ Bases:
avocado.core.plugin_interfaces.Init
-
description
= 'nrunner initialization'¶
-
initialize
()¶ Entry point for the plugin to perform its initialization.
-
name
= 'nrunner'¶
-
avocado.plugins.sysinfo module¶
System information plugin
-
class
avocado.plugins.sysinfo.
SysInfo
¶ Bases:
avocado.core.plugin_interfaces.CLICmd
Collect system information
-
configure
(parser)¶ Add the subparser for the run action.
Parameters: parser ( avocado.core.parser.ArgumentParser
) – The Avocado command line application parser
-
description
= 'Collect system information'¶
-
name
= 'sysinfo'¶
-
run
(config)¶ Entry point for actually running the command.
-
-
class
avocado.plugins.sysinfo.
SysInfoJob
(config)¶ Bases:
avocado.core.plugin_interfaces.JobPreTests
,avocado.core.plugin_interfaces.JobPostTests
-
description
= 'Collects system information before/after the job is run'¶
-
name
= 'sysinfo'¶
-
post_tests
(job)¶ Entry point for job running actions after the tests execution.
-
pre_tests
(job)¶ Entry point for job running actions before tests execution.
-
-
class
avocado.plugins.sysinfo.
SysInfoTest
¶ Bases:
avocado.core.plugin_interfaces.PreTest
,avocado.core.plugin_interfaces.PostTest
Implements the sysinfo pre/post test plugin.
It will create pre/post-test tasks for collecting system information.
-
description
= 'Collects system information before/after the test is run.'¶
-
name
= 'sysinfo'¶
-
post_test_runnables
(test_runnable, suite_config=None)¶ Entry point for creating runnables, which will be run after test.
Parameters: - test_runnable – Runnable of the Test itself.
- suite_config – Configuration dict relevant for the whole suite.
Returns: PostTest task runnables created by plugin.
Return type: list of tuple(
avocado.core.nrunner.Runnable
,avocado.core.task.runtime.RuntimeTask.possible_dependency_results)
-
pre_test_runnables
(test_runnable, suite_config=None)¶ Entry point for creating runnables, which will be run before test.
Parameters: - test_runnable – Runnable of the Test itself.
- suite_config – Configuration dict relevant for the whole suite.
Returns: PreTest task runnables created by plugin.
Return type: list of
avocado.core.nrunner.Runnable
-
-
class
avocado.plugins.sysinfo.
SysinfoInit
¶ Bases:
avocado.core.plugin_interfaces.Init
-
description
= 'Initializes sysinfo settings'¶
-
initialize
()¶ Entry point for the plugin to perform its initialization.
-
name
= 'sysinfo'¶
-
avocado.plugins.tap module¶
TAP output module.
-
class
avocado.plugins.tap.
TAP
¶ Bases:
avocado.core.plugin_interfaces.CLI
TAP Test Anything Protocol output avocado plugin
-
configure
(parser)¶ Configures the command line parser with options specific to this plugin.
-
description
= 'TAP - Test Anything Protocol results'¶
-
name
= 'TAP'¶
-
run
(config)¶ Execute any action the plugin intends.
Example of action may include activating a special features upon finding that the requested command line options were set by the user.
Note: this plugin class is not intended for adding new commands, for that please use CLICmd.
-
-
class
avocado.plugins.tap.
TAPInit
¶ Bases:
avocado.core.plugin_interfaces.Init
-
description
= 'TAP - Test Anything Protocol - result plugin initialization'¶
-
initialize
()¶ Entry point for the plugin to perform its initialization.
-
name
= 'TAP'¶
-
-
class
avocado.plugins.tap.
TAPResult
(config)¶ Bases:
avocado.core.plugin_interfaces.ResultEvents
TAP output class
-
description
= 'TAP - Test Anything Protocol results'¶
-
end_test
(result, state)¶ Log the test status and details
-
name
= 'tap'¶
-
post_tests
(job)¶ Entry point for job running actions after the tests execution.
-
pre_tests
(job)¶ Log the test plan
-
start_test
(result, state)¶ Event triggered when a test starts running.
-
test_progress
(progress=False)¶ Interface to notify progress (or not) of the running test.
-
-
avocado.plugins.tap.
file_log_factory
(log_file)¶ Generates a function which simulates writes to logger and outputs to file
Parameters: log_file – The output file
avocado.plugins.testlogs module¶
-
class
avocado.plugins.testlogs.
TestLogging
(config)¶ Bases:
avocado.core.plugin_interfaces.ResultEvents
- TODO: The description should be changed when the legacy runner will be
- deprecated.
-
description
= 'Nrunner specific Test logs for Job'¶
-
end_test
(result, state)¶ Event triggered when a test finishes running.
-
post_tests
(job)¶ Entry point for job running actions after the tests execution.
-
pre_tests
(job)¶ Entry point for job running actions before tests execution.
-
start_test
(result, state)¶ Event triggered when a test starts running.
-
test_progress
(progress=False)¶ Interface to notify progress (or not) of the running test.
-
class
avocado.plugins.testlogs.
TestLogsUI
¶ Bases:
avocado.core.plugin_interfaces.JobPre
,avocado.core.plugin_interfaces.JobPost
-
description
= "Shows content from tests' logs"¶
-
post
(job)¶ Entry point for actually running the post job action.
-
pre
(job)¶ Entry point for actually running the pre job action.
-
-
class
avocado.plugins.testlogs.
TestLogsUIInit
¶ Bases:
avocado.core.plugin_interfaces.Init
-
description
= 'Initialize testlogs plugin settings'¶
-
initialize
()¶ Entry point for the plugin to perform its initialization.
-
avocado.plugins.teststmpdir module¶
Tests temporary directory plugin
-
class
avocado.plugins.teststmpdir.
TestsTmpDir
¶ Bases:
avocado.core.plugin_interfaces.JobPre
,avocado.core.plugin_interfaces.JobPost
-
description
= 'Creates a temporary directory for tests consumption'¶
-
name
= 'teststmpdir'¶
-
post
(job)¶ Entry point for actually running the post job action.
-
pre
(job)¶ Entry point for actually running the pre job action.
-
avocado.plugins.variants module¶
-
class
avocado.plugins.variants.
Variants
¶ Bases:
avocado.core.plugin_interfaces.CLICmd
Implements “variants” command to visualize/debug test variants and params
-
configure
(parser)¶ Lets the extension add command line options and do early configuration.
By default it will register its name as the command name and give its description as the help message.
-
description
= 'Tool to analyze and visualize test variants and params'¶
-
name
= 'variants'¶
-
run
(config)¶ Entry point for actually running the command.
-
-
avocado.plugins.variants.
map_verbosity_level
(level)¶
avocado.plugins.vmimage module¶
-
class
avocado.plugins.vmimage.
VMimage
¶ Bases:
avocado.core.plugin_interfaces.CLICmd
Implements the avocado ‘vmimage’ subcommand
-
configure
(parser)¶ Lets the extension add command line options and do early configuration.
By default it will register its name as the command name and give its description as the help message.
-
description
= 'Provides VM images acquired from official repositories'¶
-
name
= 'vmimage'¶
-
run
(config)¶ Entry point for actually running the command.
-
-
avocado.plugins.vmimage.
display_images_list
(images)¶ Displays table with information about images :param images: list with image’s parameters :type images: list of dicts
-
avocado.plugins.vmimage.
download_image
(distro, version=None, arch=None)¶ Downloads the vmimage to the cache directory if doesn’t already exist
Parameters: Raises: AttributeError – When image can’t be downloaded
Returns: Information about downloaded image
Return type:
-
avocado.plugins.vmimage.
list_downloaded_images
()¶ List the available Image inside avocado cache :return: list with image’s parameters :rtype: list of dicts
avocado.plugins.xunit module¶
xUnit module.
-
class
avocado.plugins.xunit.
XUnitCLI
¶ Bases:
avocado.core.plugin_interfaces.CLI
xUnit output
-
configure
(parser)¶ Configures the command line parser with options specific to this plugin.
-
description
= 'xUnit output options'¶
-
name
= 'xunit'¶
-
run
(config)¶ Execute any action the plugin intends.
Example of action may include activating a special features upon finding that the requested command line options were set by the user.
Note: this plugin class is not intended for adding new commands, for that please use CLICmd.
-
-
class
avocado.plugins.xunit.
XUnitInit
¶ Bases:
avocado.core.plugin_interfaces.Init
-
description
= 'xUnit job result initialization'¶
-
initialize
()¶ Entry point for the plugin to perform its initialization.
-
name
= 'xunit'¶
-
-
class
avocado.plugins.xunit.
XUnitResult
¶ Bases:
avocado.core.plugin_interfaces.Result
-
PRINTABLE
= 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~\n\r '¶
-
UNKNOWN
= '<unknown>'¶
-
description
= 'XUnit result support'¶
-
name
= 'xunit'¶
-
render
(result, job)¶ Entry point with method that renders the result.
This will usually be used to write the result to a file or directory.
Parameters: - result (
avocado.core.result.Result
) – the complete job result - job (
avocado.core.job.Job
) – the finished job for which a result will be written
- result (
-