avocado.core.plugins package

Submodules

avocado.core.plugins.builtin module

Builtin plugins.

avocado.core.plugins.builtin.load_builtins()

Load builtin plugins.

Returns:a list of plugin classes, ordered by priority.

avocado.core.plugins.config module

class avocado.core.plugins.config.ConfigOptions(name=None, enabled=None)

Bases: avocado.core.plugins.plugin.Plugin

Implements the avocado ‘config’ subcommand

Creates a new plugin instance.

Parameters:
  • name – plugin short name.
  • enabled – plugin status: enabled or not.
configure(parser)
enabled = True
name = 'config'
run(args)

avocado.core.plugins.distro module

avocado.core.plugins.distro.DISTRO_PKG_INFO_LOADERS = {'deb': <class 'avocado.core.plugins.distro.DistroPkgInfoLoaderDeb'>, 'rpm': <class 'avocado.core.plugins.distro.DistroPkgInfoLoaderRpm'>}

the type of distro that will determine what loader will be used

class avocado.core.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.core.plugins.distro.DistroOptions(name=None, enabled=None)

Bases: avocado.core.plugins.plugin.Plugin

Implements the avocado ‘distro’ subcommand

Creates a new plugin instance.

Parameters:
  • name – plugin short name.
  • enabled – plugin status: enabled or not.
configure(parser)
enabled = True
get_output_file_name(args)

Adapt the output file name based on given args

It’s not uncommon for some distros to not have a release number, so adapt the output file name to that

name = 'distro'
run(args)
class avocado.core.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 calling load_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 from DistroPkgInfoLoader 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.core.plugins.distro.DistroPkgInfoLoaderDeb(path)

Bases: avocado.core.plugins.distro.DistroPkgInfoLoader

Loads package information for DEB files

get_package_info(path)
is_software_package(path)
class avocado.core.plugins.distro.DistroPkgInfoLoaderRpm(path)

Bases: avocado.core.plugins.distro.DistroPkgInfoLoader

Loads package information for RPM files

get_package_info(path)
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.core.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.core.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.core.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 ofter 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.core.plugins.distro.save_distro(linux_distro, path)

Saves the linux_distro to an external file format

Parameters:
Returns:

None

avocado.core.plugins.exec_path module

Libexec PATHs modifier

class avocado.core.plugins.exec_path.ExecPath(name=None, enabled=None)

Bases: avocado.core.plugins.plugin.Plugin

Implements the avocado ‘exec-path’ subcommand

Creates a new plugin instance.

Parameters:
  • name – plugin short name.
  • enabled – plugin status: enabled or not.
configure(parser)

Add the subparser for the exec-path action.

Parameters:parser – Main test runner parser.
enabled = True
name = 'exec_path'
priority = 0
run(args)

Print libexec path and finish

Parameters:args – Command line args received from the run subparser.
view = None

avocado.core.plugins.gdb module

Run tests with GDB goodies enabled.

class avocado.core.plugins.gdb.GDB(name=None, enabled=None)

Bases: avocado.core.plugins.plugin.Plugin

Run tests with GDB goodies enabled

Creates a new plugin instance.

Parameters:
  • name – plugin short name.
  • enabled – plugin status: enabled or not.
activate(app_args)
configure(parser)
enabled = True
name = 'gdb'

avocado.core.plugins.htmlresult module

HTML output module.

class avocado.core.plugins.htmlresult.HTML(name=None, enabled=None)

Bases: avocado.core.plugins.plugin.Plugin

HTML job report

Creates a new plugin instance.

Parameters:
  • name – plugin short name.
  • enabled – plugin status: enabled or not.
activate(app_args)
configure(parser)
enabled = True
name = 'htmlresult'
class avocado.core.plugins.htmlresult.HTMLTestResult(stream=None, args=None)

Bases: avocado.core.result.TestResult

HTML Test Result class.

command_line_arg_name = '--html'
end_test(state)

Called when the given test has been run.

Parameters:state (dict) – result of avocado.core.test.Test.get_state.
end_tests()

Called once after all tests are executed.

start_tests()

Called once before any tests are executed.

class avocado.core.plugins.htmlresult.ReportModel(json_input, html_output)

Bases: object

Prepares JSON that can be passed up to mustache for rendering.

Base JSON that comes from test results.

execution_time()
get(key, default)
hostname()
job_id()
logdir()
pass_rate()
passed()
results_dir(relative_links=True)
results_dir_basename()
sysinfo()
tests
total()

avocado.core.plugins.journal module

Journal Plugin

class avocado.core.plugins.journal.Journal(name=None, enabled=None)

Bases: avocado.core.plugins.plugin.Plugin

Test journal

Creates a new plugin instance.

Parameters:
  • name – plugin short name.
  • enabled – plugin status: enabled or not.
activate(args)
configure(parser)
enabled = True
name = 'journal'
class avocado.core.plugins.journal.TestResultJournal(stream=None, args=None)

Bases: avocado.core.result.TestResult

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 TestResultJournal.

Parameters:
command_line_arg_name = '--journal'
end_test(state)
end_tests()
lazy_init_journal(state)
start_test(state)

avocado.core.plugins.jsonresult module

JSON output module.

class avocado.core.plugins.jsonresult.JSON(name=None, enabled=None)

Bases: avocado.core.plugins.plugin.Plugin

JSON output

Creates a new plugin instance.

Parameters:
  • name – plugin short name.
  • enabled – plugin status: enabled or not.
activate(app_args)
configure(parser)
enabled = True
name = 'json'
class avocado.core.plugins.jsonresult.JSONTestResult(stream=None, args=None)

Bases: avocado.core.result.TestResult

JSON Test Result class.

command_line_arg_name = '--json'
end_test(state)

Called when the given test has been run.

Parameters:state (dict) – result of avocado.core.test.Test.get_state.
end_tests()

Called once after all tests are executed.

start_tests()

Called once before any tests are executed.

avocado.core.plugins.manager module

Plugin Managers.

class avocado.core.plugins.manager.AvocadoPluginManager

Bases: avocado.core.plugins.manager.BuiltinPluginManager, avocado.core.plugins.manager.ExternalPluginManager

Avocado Plugin Manager.

Load builtins and external plugins.

load_plugins(path=None)
class avocado.core.plugins.manager.BuiltinPluginManager

Bases: avocado.core.plugins.manager.PluginManager

Builtins plugin manager.

load_plugins()
class avocado.core.plugins.manager.ExternalPluginManager

Bases: avocado.core.plugins.manager.PluginManager

Load external plugins.

load_plugins(path, pattern='avocado_*.py')
class avocado.core.plugins.manager.PluginManager

Bases: object

Base class for plugins manager.

You’ll inherit from this to write you own plugins manager.

activate(app_args)
add_plugin(plugin)
configure(parser)
load_plugins()
avocado.core.plugins.manager.get_plugin_manager()

Get default plugin manager.

avocado.core.plugins.multiplexer module

class avocado.core.plugins.multiplexer.Multiplexer(*args, **kwargs)

Bases: avocado.core.plugins.plugin.Plugin

Implements the avocado ‘multiplex’ subcommand

activate(args)
configure(parser)
enabled = True
name = 'multiplexer'
run(args)

avocado.core.plugins.plugin module

class avocado.core.plugins.plugin.Plugin(name=None, enabled=None)

Bases: object

Base class for plugins.

You’ll inherit from this to write you own plugins.

Creates a new plugin instance.

Parameters:
  • name – plugin short name.
  • enabled – plugin status: enabled or not.
activate(arguments)

Activate plugin.

Parameters:arguments – the parsed arguments.
configure(parser)

Configuration and argument parsing.

Parameters:parser – an instance of avocado.core.parser.Parser

To create a runner plugin, just call this method with super(). To create a result plugin, just set configure to True.

enabled = False
get_resource_path(*args)

Get the path of a plugin resource (static files, templates, etc).

Parameters:args – Path components (plugin resources dir is the root).
Returns:Full resource path.
name = 'noname'
parser = None
priority = 3
run(arguments)

Run plugin.

Parameters:arguments – the parsed arguments.

avocado.core.plugins.plugin_list module

class avocado.core.plugins.plugin_list.PluginList(name=None, enabled=None)

Bases: avocado.core.plugins.plugin.Plugin

Implements the avocado ‘plugins’ subcommand

Creates a new plugin instance.

Parameters:
  • name – plugin short name.
  • enabled – plugin status: enabled or not.
configure(parser)
enabled = True
name = 'plugins_list'
run(args)

avocado.core.plugins.remote module

Run tests on a remote machine.

class avocado.core.plugins.remote.RunRemote(name=None, enabled=None)

Bases: avocado.core.plugins.plugin.Plugin

Run tests on a remote machine

Creates a new plugin instance.

Parameters:
  • name – plugin short name.
  • enabled – plugin status: enabled or not.
activate(app_args)
configure(parser)
enabled = True
name = 'run_remote'
remote_parser = None

avocado.core.plugins.runner module

Base Test Runner Plugins.

class avocado.core.plugins.runner.TestRunner(name=None, enabled=None)

Bases: avocado.core.plugins.plugin.Plugin

Implements the avocado ‘run’ subcommand

Creates a new plugin instance.

Parameters:
  • name – plugin short name.
  • enabled – plugin status: enabled or not.
activate(args)
configure(parser)

Add the subparser for the run action.

Parameters:parser – Main test runner parser.
enabled = True
name = 'test_runner'
priority = 0
run(args)

Run test modules or simple tests.

Parameters:args – Command line args received from the run subparser.

avocado.core.plugins.sysinfo module

System information plugin

class avocado.core.plugins.sysinfo.SystemInformation(name=None, enabled=None)

Bases: avocado.core.plugins.plugin.Plugin

Collect system information

Creates a new plugin instance.

Parameters:
  • name – plugin short name.
  • enabled – plugin status: enabled or not.
configure(parser)

Add the subparser for the run action.

Parameters:parser – Main test runner parser.
enabled = True
name = 'sysinfo'
run(args)

avocado.core.plugins.test_list module

class avocado.core.plugins.test_list.TestList(name=None, enabled=None)

Bases: avocado.core.plugins.plugin.Plugin

Implements the avocado ‘list’ subcommand

Creates a new plugin instance.

Parameters:
  • name – plugin short name.
  • enabled – plugin status: enabled or not.
configure(parser)

Add the subparser for the list action.

Parameters:parser – Main test runner parser.
enabled = True
name = 'test_lister'
priority = 0
run(args)
class avocado.core.plugins.test_list.TestLister(args)

Bases: object

Lists available test modules

list()

avocado.core.plugins.vm module

Run tests on Virtual Machine.

class avocado.core.plugins.vm.RunVM(name=None, enabled=None)

Bases: avocado.core.plugins.plugin.Plugin

Run tests on a Virtual Machine

Creates a new plugin instance.

Parameters:
  • name – plugin short name.
  • enabled – plugin status: enabled or not.
activate(app_args)
configure(parser)
enabled = True
name = 'run_vm'
vm_parser = None

avocado.core.plugins.wrapper module

class avocado.core.plugins.wrapper.Wrapper(name=None, enabled=None)

Bases: avocado.core.plugins.plugin.Plugin

Implements the ‘–wrapper’ flag for the ‘run’ subcommand

Creates a new plugin instance.

Parameters:
  • name – plugin short name.
  • enabled – plugin status: enabled or not.
activate(app_args)
configure(parser)
enabled = True
name = 'wrapper'

avocado.core.plugins.xunit module

xUnit module.

class avocado.core.plugins.xunit.XUnit(name=None, enabled=None)

Bases: avocado.core.plugins.plugin.Plugin

xUnit output

Creates a new plugin instance.

Parameters:
  • name – plugin short name.
  • enabled – plugin status: enabled or not.
activate(app_args)
configure(parser)
enabled = True
name = 'xunit'
class avocado.core.plugins.xunit.XmlResult

Bases: object

Handles the XML details for xUnit output.

add_error(state)

Add a testcase node of kind error.

Parameters:state (dict) – result of avocado.core.test.Test.get_state.
add_failure(state)

Add a testcase node of kind failed.

Parameters:state (dict) – result of avocado.core.test.Test.get_state.
add_skip(state)

Add a testcase node of kind skipped.

Parameters:state (dict) – result of avocado.core.test.Test.get_state.
add_success(state)

Add a testcase node of kind succeed.

Parameters:state (dict) – result of avocado.core.test.Test.get_state.
end_testsuite(tests, errors, failures, skip, total_time)

End of testsuite node.

Parameters:
  • tests – Number of tests.
  • errors – Number of test errors.
  • failures – Number of test failures.
  • skip – Number of test skipped.
  • total_time – The total time of test execution.
get_contents()
start_testsuite(timestamp)

Start a new testsuite node.

Parameters:timestamp – Timestamp string in date/time format.
class avocado.core.plugins.xunit.xUnitTestResult(stream=None, args=None)

Bases: avocado.core.result.TestResult

xUnit Test Result class.

Creates an instance of xUnitTestResult.

Parameters:
command_line_arg_name = '--xunit'
end_test(state)

Record an end test event, accord to the given test status.

Parameters:state (dict) – result of avocado.core.test.Test.get_state.
end_tests()

Record an end tests event.

start_test(test)

Record a start test event.

start_tests()

Record a start tests event.

Module contents