Plugin API¶
Balder provides a separate class that helps to implement your own plugin.
The BalderPlugin
¶
The main object to get access to the deep functionality of Balder is the BalderPlugin
class. You can
overwrite it in every balderglob.py file.
- class balder.BalderPlugin(session: BalderSession)¶
This is the balder plugin class. You can create your own plugin, by creating a subclass of it. With that you are able to overwrite the methods you want to use in your plugin.
- addoption(argument_parser: argparse.ArgumentParser)¶
The callback will be executed while the ArgumentParser is being created.
- Parameters
argument_parser – the argument parser object
- filter_executor_tree(executor_tree: ExecutorTree) None ¶
This callback will be executed before the ExecutorTree runs. It contains the current representation of the
ExecutorTree
, that will be executed in the next step. With this callback it is possible to manipulate theExecutorTree
. You have not to return something, the givenexecutor_tree
is a reference.- Parameters
executor_tree – the reference to the main
ExecutorTree
object balder uses for this session
- modify_collected_classes(scenarios: List[Type[Scenario]], setups: List[Type[Setup]]) Tuple[List[Type[Scenario]], List[Type[Setup]]] ¶
This callback will be executed after the
Collector
has collected theScenario
classes and theSetup
classes.
- modify_collected_pyfiles(pyfiles: List[pathlib.Path]) List[pathlib.Path] ¶
This callback will be executed after the
Collector
has collected all python files that are inside the current working directory.Note
Note that these files are not filtered yet. The list will contain every existing python file.
- Parameters
pyfiles – a list with all python filepaths
- Returns
the new list of all filepaths
- session_finished(executor_tree: Union[ExecutorTree, None])¶
This callback will be executed at the end of every session. The callback will run in a collect-only and resolve-only session too. Note, that the executor_tree argument is None in a collect-only session.
- Parameters
executor_tree – the reference to the main
ExecutorTree
object that balder uses for this session