quilla.plugins package¶
Submodules¶
quilla.plugins.base_storage module¶
This module contains a base class that can be useful when defining new storage plugins, as there are some behaviours that will be shared among the configuration objects
- class quilla.plugins.base_storage.BaseStorage¶
Bases:
abc.ABC
- abstract cleanup_reports()¶
Searches for reports that match some cleanup criteria, and deletes them if necessary. Not every storage plugin will implement logic for this function, choosing instead to have all images exist indefinitely.
- abstract find_image_by_baseline(baseline_id)¶
Searches the defined storage method for the image matching some baseline ID
- Parameters
baseline_id (
str
) – The unique ID to search for. It is assumed every baseline ID is unique regardless of what test is requesting it.- Return type
bytes
- Returns
The bytes representation of the stored image if found, or an empty bytes object if the image is not found.
- get_baseline_uri(run_id, baseline_id)¶
Retrieves the URI for the baseline image
- Parameters
run_id (
str
) – The unique ID for the current run of Quillabaseline_id (
str
) – The unique ID for the baseline image
- Return type
Optional
[str
]- Returns
None if the plugin is not enabled, a string URI if it is
- get_image(baseline_id)¶
Determines if the plugin should run, and if so searches for the image with the specified baseline ID and returns the byte data for it
- Parameters
baseline_id (
str
) – The unique ID to search for- Return type
Optional
[bytes
]- Returns
None if the plugin is not enabled, a
bytes
representation of the image if it is. If no baseline image is found, returns an empty byte string
- abstract property is_enabled: bool¶
A property to be used to determine if the plugin is configured and therefore able to run
- Return type
bool
- Returns
True if the plugin is configured, False otherwise
- abstract make_baseline_uri(run_id, baseline_id)¶
Generates a baseline URI for the current run given the baseline_id of the image.
It is recommended that plugins create a clone of the baseline image when generating the URI so that the returned URI will uniquely identify the baseline that was used for the associated run ID. This ensures that even if the baseline image is updated, the report is still meaningful.
- Parameters
run_id (
str
) – The unique ID identifying the current runbaseline_id (
str
) – The unique identifier for the image
- Return type
str
- Returns
A URI that can locate the baseline image used for the given run
- quilla_get_baseline_uri(run_id, baseline_id)¶
- Return type
Optional
[str
]
- quilla_get_visualparity_baseline(baseline_id)¶
- Return type
Optional
[bytes
]
- quilla_store_image(ctx, baseline_id, image_bytes, image_type)¶
Stores a given image based on its type and possibly the run ID
- Parameters
ctx (
Context
) – The runtime context for Quillabaseline_id (
str
) – The unique identifier for the imageimage_bytes (
bytes
) – The byte data for the imageimage_type (
VisualParityImageType
) – The kind of image that is being stored
- Return type
Optional
[str
]- Returns
A URI for the image that was stored, or None if the plugin is not enabled. The URI might be the empty string if the image type is not supported
- abstract store_baseline_image(run_id, baseline_id, baseline)¶
Stores a baseline image under the given baseline_id.
This function should be used to update the current baseline image, or create a new one if the baseline did not previously exist.
The run ID is passed in case a plugin would like to use it to version and store previous image baselines
- Parameters
run_id (
str
) – The ID of the current run of Quillabaseline_id (
str
) – A unique identifier for the imagebaseline (
bytes
) – The image data in bytes
- Return type
str
- Returns
A URI for the new baseline image
- abstract store_treatment_image(run_id, baseline_id, treatment)¶
Stores a treatment image within the storage mechanism enabled by the plugin
- Parameters
run_id (
str
) – The run ID of the current Quilla run, to version the treatment imagesbaseline_id (
str
) – The ID of the baseline that this treatment image is associated withtreatment (
bytes
) – The image data in bytes
- Return type
str
- Returns
An identifier that can locate the newly stored treatment image
quilla.plugins.blob_storage module¶
- class quilla.plugins.blob_storage.BlobStorage¶
Bases:
quilla.plugins.base_storage.BaseStorage
- cleanup_reports()¶
Searches for reports that match some cleanup criteria, and deletes them if necessary. Not every storage plugin will implement logic for this function, choosing instead to have all images exist indefinitely.
- configure(connection_string, container_name, retention_days)¶
Configure the container client and other necessary data, such as the max cleanup time.
If a container with that name does not exist, it will be created.
- Parameters
connection_string (
str
) – The full connection string to the storage accountcontainer_name (
str
) – The name of the container that should be used to store all imagesretention_days (
int
) – The maximum number of days a report should be allowed to have before being cleaned up
- property container_client: azure.storage.blob._container_client.ContainerClient¶
An instance of the container client, casting it to ContainerClient.
This should be used exclusively from the abstract methods from BaseStorage
- Return type
ContainerClient
- Returns
The container client
- find_image_by_baseline(baseline_id)¶
Searches the defined storage method for the image matching some baseline ID
- Parameters
baseline_id (
str
) – The unique ID to search for. It is assumed every baseline ID is unique regardless of what test is requesting it.- Return type
bytes
- Returns
The bytes representation of the stored image if found, or an empty bytes object if the image is not found.
- property is_enabled: bool¶
A property to be used to determine if the plugin is configured and therefore able to run
- Return type
bool
- Returns
True if the plugin is configured, False otherwise
- make_baseline_uri(run_id, baseline_id)¶
Generates a baseline URI for the current run given the baseline_id of the image.
It is recommended that plugins create a clone of the baseline image when generating the URI so that the returned URI will uniquely identify the baseline that was used for the associated run ID. This ensures that even if the baseline image is updated, the report is still meaningful.
- Parameters
run_id (
str
) – The unique ID identifying the current runbaseline_id (
str
) – The unique identifier for the image
- Return type
str
- Returns
A URI that can locate the baseline image used for the given run
- max_retention_days: int¶
- quilla_addopts(parser)¶
Adds the appropriate CLI arguments
- Parameters
parser (
ArgumentParser
) – The Quilla argument parser
- quilla_configure(args)¶
Configures the plugin to run
- Parameters
args (
Namespace
) – A namespace generated by parsing the args from the CLI
- store_baseline_image(run_id, baseline_id, baseline)¶
Stores a baseline image under the given baseline_id.
This function should be used to update the current baseline image, or create a new one if the baseline did not previously exist.
The run ID is passed in case a plugin would like to use it to version and store previous image baselines
- Parameters
run_id (
str
) – The ID of the current run of Quillabaseline_id (
str
) – A unique identifier for the imagebaseline (
bytes
) – The image data in bytes
- Return type
str
- Returns
A URI for the new baseline image
- store_treatment_image(run_id, baseline_id, treatment)¶
Stores a treatment image within the storage mechanism enabled by the plugin
- Parameters
run_id (
str
) – The run ID of the current Quilla run, to version the treatment imagesbaseline_id (
str
) – The ID of the baseline that this treatment image is associated withtreatment (
bytes
) – The image data in bytes
- Return type
str
- Returns
An identifier that can locate the newly stored treatment image
quilla.plugins.local_storage module¶
A plugin to add LocalStorage functionality for the VisualParity plugin.
- class quilla.plugins.local_storage.LocalStorage(storage_directory=None)¶
Bases:
quilla.plugins.base_storage.BaseStorage
- baseline_directory: Optional[pathlib.Path]¶
- cleanup_reports()¶
Method left blank, as no cleanup is provided for LocalStorage since users are expected to have granular control over their own filesystems
- configure(storage_directory)¶
Initialize all the required data
- find_image_by_baseline(baseline_id)¶
Searches the defined storage method for the image matching some baseline ID
- Parameters
baseline_id (
str
) – The unique ID to search for. It is assumed every baseline ID is unique regardless of what test is requesting it.- Return type
bytes
- Returns
The bytes representation of the stored image if found, or an empty bytes object if the image is not found.
- property is_enabled: bool¶
A property to be used to determine if the plugin is configured and therefore able to run
- Return type
bool
- Returns
True if the plugin is configured, False otherwise
- make_baseline_uri(run_id, baseline_id)¶
Generates a baseline URI for the current run given the baseline_id of the image.
It is recommended that plugins create a clone of the baseline image when generating the URI so that the returned URI will uniquely identify the baseline that was used for the associated run ID. This ensures that even if the baseline image is updated, the report is still meaningful.
- Parameters
run_id (
str
) – The unique ID identifying the current runbaseline_id (
str
) – The unique identifier for the image
- Return type
str
- Returns
A URI that can locate the baseline image used for the given run
- quilla_addopts(parser)¶
Using the Quilla hook to add a new group of CLI args to the parser
- quilla_configure(args)¶
- run_path(run_id)¶
- Return type
Path
- runs_directory: Optional[pathlib.Path]¶
- store_baseline_image(run_id, baseline_id, baseline)¶
Stores a baseline image under the given baseline_id.
This function should be used to update the current baseline image, or create a new one if the baseline did not previously exist.
The run ID is passed in case a plugin would like to use it to version and store previous image baselines
- Parameters
run_id (
str
) – The ID of the current run of Quillabaseline_id (
str
) – A unique identifier for the imagebaseline (
bytes
) – The image data in bytes
- Return type
str
- Returns
A URI for the new baseline image
- store_treatment_image(run_id, baseline_id, treatment)¶
Stores a treatment image within the storage mechanism enabled by the plugin
- Parameters
run_id (
str
) – The run ID of the current Quilla run, to version the treatment imagesbaseline_id (
str
) – The ID of the baseline that this treatment image is associated withtreatment (
bytes
) – The image data in bytes
- Return type
str
- Returns
An identifier that can locate the newly stored treatment image
Module contents¶
- quilla.plugins.get_plugin_manager(path, logger)¶
Creates and configures a plugin manager by loading all the plugins defined through entrypoints or through a uiconf.py file found at the path location
- Parameters
path (
str
) – the directory in which the uiconf.py will be found- Return type
PluginManager
- Returns
a configured PluginManager instance with all plugins already loaded