As detailed in the following card: https://trello.com/c/oWzrV48E/837-execution-order-support-in-plugins
It should be possible to specify a custom order for plugins to be executed by setting specific configuration. The first observed approach would be to create a section called `[plugins.<type>]` where the `<type>` conforms to the description on fully qualified plugin names given here: https://github.com/avocado-framework/avocado/pull/1495/commits/193a10ce98cb5747395eefcb485dd452696b4b11#diff-0f4f89ace79fa15278d9b283c2d9d9b2R84 Then, by creating a key named `order`, containing the short names as a list. Enabled plugins not listed will be executed *after* plugins listed, but in non-determined order. For instance, consider the following entry points:: 'avocado.plugins.result' : [ 'xunit = avocado.plugins.xunit:XUnitResult', 'json = avocado.plugins.jsonresult:JSONResult', 'archive = avocado.plugins.archive:Archive', 'mail = avocado.plugins.mail:Mail', 'html = avocado_result_html:HTMLResult' ] We can say that: * The plugin type, according to the fully qualified plugin name definition here is `result`. * The plugin fully qualified names are: - result.xunit - result.json - result.archive - result.mail - result.html * The short names for plugins of type "result" are: - xunit - json - archive - mail - html To make sure that the mail plugin is run after (and thus includes) the HTML result, the following configuration entry can be set:: [plugins.result] order = html, archive The other result plugins, namely xunit, json and mail, will still be run. It's guaranteed they'll be run *after* the other result plugins. The order in which they'll run after the explicitly ordered plugins is undefined. Other possible approach ----------------------- The other approach possible, would require a default order value for plugins. This would still preferably be done in configuration rather than in code. Then, the fully qualified name for a plugin could be used as part of the configuration section. Example:: [plugin.result.archive] order = 50 [plugin.result.html] order = 30 This would make the `html` plugin run before the `archive` plugin. While more verbose, it would allow for external plugins to ship with stock configuration files that would set, by default, its ordering. Feedback is highly appreciated! -- Cleber Rosa [ Sr Software Engineer - Virtualization Team - Red Hat ] [ Avocado Test Framework - avocado-framework.github.io ]
