bec_widgets.utils.reference_utils#

Attributes#

Functions#

compare_images(image1_path, reference_image_path)

Load two images and compare them pixel by pixel

snap_and_compare(widget, output_directory[, suffix])

Save a rendering of a widget and compare it to a reference image

Module Contents#

compare_images(image1_path: str, reference_image_path: str)#

Load two images and compare them pixel by pixel

Parameters:
  • image1_path (str) – The path to the first image

  • reference_image_path (str) – The path to the reference image

Raises:

ValueError – If the images are different

snap_and_compare(widget: Any, output_directory: str, suffix: str = '')#

Save a rendering of a widget and compare it to a reference image

Parameters:
  • widget (any) – The widget to render

  • output_directory (str) – The directory to save the image to

  • suffix (str) – A suffix to append to the image name

Raises:

ValueError – If the images are different

Examples

snap_and_compare(widget, tmpdir, suffix=”started”)

REFERENCE_DIR#
REFERENCE_DIR_FAILURES#