Bug#851359: diffoscope: Improve support for comparing images

Maria Glukhova siamezzze at gmail.com
Sat Apr 29 17:40:27 UTC 2017


Hi Chris,

Thanks again for your guidance and help!


On 24.04.2017 19:13, Chris Lamb wrote:
> So, I think…
>
>     if get_image_size(self.path) != get_image_size(other.path):
>         raise AssertionError
>
> … are better written as:
>
>     assert get_image_size(self.path) == get_image_size(other.path)
>
> Or at least it is more Pythonic…  However, we should definitely *not*
> be catching AssertionError like that for control flow, so either we need
> to raise a different exception or find some other way of doing this.

Yes, I was looking at assert, but specification around it being ignored
when -O option is passed to Python scared me off. Anyway, thanks for
pointing out that AssertionError should not be handled like that.
I moved the try/except for the image size and number of frames into the
corresponding functions and removed that AssertionError.

>   a) We should rename this global variable to something that reflects
>      this usage.

Thanks, renamed.

>   b) We could always just calculate the visual diffs and simply not
>      render them in the presenter backends that do not support them.
>      Are they remarkably slow, for example?

Well, enabling them makes comparing test images around 1.5 times slower.
I wanted to avoid this increase when possible. Don't know if it worths it.

Regards,
Maria



More information about the Reproducible-builds mailing list