diff --git a/tests/definitions_test.py b/tests/definitions_test.py index 85701d8af..78e479021 100644 --- a/tests/definitions_test.py +++ b/tests/definitions_test.py @@ -221,7 +221,7 @@ def test_definitions(file_path, schema, change_type): # Check for images if front_image or rear_image is True if (definition.get('front_image') or definition.get('rear_image')): # Find images for given manufacturer, with matching device slug (exact match including case) - manufacturer_images = [image[1] for image in image_files if image[0] == file_path.split('/')[1] and os.path.basename(image[1]).split('.')[0] == this_device.get_slug()] + manufacturer_images = [image[1] for image in image_files if image[0] == file_path.split(os.path.sep)[1] and os.path.basename(image[1]).split('.')[0] == this_device.get_slug()] if not manufacturer_images: pytest.fail(f'{file_path} has Front or Rear Image set to True but no images found for manufacturer/device (slug={this_device.get_slug()})', False) elif len(manufacturer_images)>2: @@ -232,13 +232,12 @@ def test_definitions(file_path, schema, change_type): front_image = [image_path.split('/')[2] for image_path in manufacturer_images if os.path.basename(image_path).split('.')[1] == 'front'] if not front_image: - pytest.fail(f'{file_path} has front_image set to True but no matching image found for device ({manufacturer_images})', False) + pytest.fail(f'{file_path} has front_image set to True but no matching image found (looking for \'elevation-images{os.path.sep}{file_path.split(os.path.sep)[1]}{os.path.sep}{this_device.get_slug()}.front.ext\' but only found {manufacturer_images})', False) - # If rear_image is True, verify that a front image exists + # If rear_image is True, verify that a rear image exists if(definition.get('rear_image')): rear_image = [image_path.split('/')[2] for image_path in manufacturer_images if os.path.basename(image_path).split('.')[1] == 'rear'] if not rear_image: - pytest.fail(f'{file_path} has rear_image set to True but no images found for device', False) - + pytest.fail(f'{file_path} has rear_image set to True but no matching image found (looking for \'elevation-images{os.path.sep}{file_path.split(os.path.sep)[1]}{os.path.sep}{this_device.get_slug()}.rear.ext\' but only found {manufacturer_images})', False) iterdict(definition)