conftest

class conftest.AnalysisPluginTestConfig(*args, **kwargs)

Bases: BaseModel

A class configuring the analysis_plugin() fixture.

Parameters:
  • args (Any) –

  • kwargs (Any) –

Return type:

Any

init_kwargs: dict

Keyword arguments to be given to the plugin_class constructor. Not supported for AnalysisPluginV0

plugin_class

The class of the plugin to be tested. It will most probably be called AnalysisPlugin.

alias of AnalysisBasePlugin

start_processes: bool = False

Whether or not to start the workers (see AnalysisPlugin.start). Not supported for AnalysisPluginV0

conftest.analysis_plugin(request, _patch_config)

Returns an instance of an AnalysisPlugin. This fixture can be configured by the supplying an instance of AnalysisPluginTestConfig as marker of the same name.

See also

The documentation of AnalysisPluginTestConfig

If this fixture does not fit your needs (which normally should not be necessary) you can define a fixture like this:

@pytest.fixture
def my_fancy_plugin(analysis_plugin)
    # Make sure the marker is defined as expected
    assert isinstance(analysis_plugin, MyFancyPlugin)
    # Patch custom things
    analysis_plugin.db_interface = CustomDbMock()
    # Return the plugin instance
    yield analysis_plugin

Note

If you want to set AnalysisPluginTestConfig.start_processes = True and want to modify plugin configuration like for example TIMEOUT you have to put the following in your test:

@pytest.mark.AnalysisPluginTestConfig(
    plugin_class=MyFancyPlugin,
    # Actually don't start the processes in the fixture
    start_processes=False,
)
def my_fancy_test(analysis_plugin, monkeypatch):
    analysis_plugin.TIMEOUT = 0
    # Now start the worker
    analysis_plugin.start()
conftest.backend_config(request, common_config, firmware_file_storage_directory)
Return type:

Backend

conftest.common_config(request, docker_mount_base_dir)
Return type:

Common

conftest.docker_mount_base_dir()
Return type:

str

conftest.firmware_file_storage_directory()
Return type:

str

conftest.frontend_config(request, common_config)
Return type:

Frontend