avocado_golang package¶
Submodules¶
avocado_golang.runner module¶
- class avocado_golang.runner.GolangRunner(runnable)¶
Bases:
avocado.core.nrunner.BaseRunner
Runner for Golang tests.
When creating the Runnable, use the following attributes:
kind: should be ‘golang’;
uri: module name and optionally a test method name, separated by colon;
args: not used
kwargs: not used
Example:
- runnable = Runnable(kind=’golang’,
uri=’countavocados:ExampleContainers’)
- run()¶
Runner main method
Yields dictionary as output, containing status as well as relevant information concerning the results.
- class avocado_golang.runner.RunnerApp(echo=<built-in function print>, prog=None, description=None)¶
Bases:
avocado.core.nrunner.BaseRunnerApp
- PROG_DESCRIPTION = 'nrunner application for golang tests'¶
The description of the command line application given to the command line parser
- PROG_NAME = 'avocado-runner-golang'¶
The name of the command line application given to the command line parser
- RUNNABLE_KINDS_CAPABLE = {'golang': <class 'avocado_golang.runner.GolangRunner'>}¶
The types of runnables that this runner can handle. Dictionary key is a name, and value is a class that inherits from
BaseRunner
- avocado_golang.runner.main()¶
Module contents¶
Plugin to run Golang tests in Avocado
- class avocado_golang.GolangCLI¶
Bases:
avocado.core.plugin_interfaces.CLI
Run Golang tests
- configure(parser)¶
Configures the command line parser with options specific to this plugin.
- description = "Golang options for 'run' subcommand"¶
- name = 'golang'¶
- 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_golang.GolangLoader(config, extra_params)¶
Bases:
avocado.core.loader.TestLoader
Golang loader class
- discover(reference, which_tests=DiscoverMode.DEFAULT)¶
Discover (possible) tests from an reference.
- Parameters
reference (str) – the reference to be inspected.
which_tests (
DiscoverMode
) – Limit tests to be displayed
- Returns
a list of test matching the reference as params.
- static get_decorator_mapping()¶
Get label mapping for display in test listing.
- Returns
Dict {TestClass: decorator function}
- static get_type_label_mapping()¶
Get label mapping for display in test listing.
- Returns
Dict {TestClass: ‘TEST_LABEL_STRING’}
- name = 'golang'¶
- class avocado_golang.GolangResolver(config=None)¶
Bases:
avocado.core.plugin_interfaces.Resolver
- description = 'Test resolver for Go language tests'¶
- name = 'golang'¶
- static 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
objects- Return type
- class avocado_golang.GolangTest(name, params=None, base_logdir=None, job=None, subtest=None, executable=None)¶
Bases:
avocado.core.test.SimpleTest
Run a Golang Test command as a SIMPLE test.
Initializes the test.
- Parameters
methodName – Name of the main method to run. For the sake of compatibility with the original unittest class, you should not set this.
name (
avocado.core.test.TestID
) – Pretty name of the test name. For normal tests, written with the avocado API, this should not be set. This is reserved for internal Avocado use, such as when running random executables as tests.base_logdir – Directory where test logs should go. If None provided a temporary directory will be created.
config (dict) – the job configuration, usually set by command line options and argument parsing
- property filename¶
Returns the path of the golang test suite.
- test()¶
Create the Golang command and execute it.
- avocado_golang.find_files(path, recursive=True)¶
- avocado_golang.find_tests(test_path)¶