question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

0.14.2: test/widgets/test_{battery,volume}.py, test/test_images{,2}.py fail

See original GitHub issue

During packaging 0.14.2 for Arch Linux, I’m again attempting to run the test suite. While it still hangs (#1130) in general, I have the following failures, some of which I have observed before:

qtile-0.14.2-check.txt

Quite a few of them fail because of test/data/svg/audio-volume-muted.svg, while the other variants of the same test work just fine!

test/test_images.py::test_get_cairo_surface[/build/qtile/src/qtile-0.14.2/test/data/svg/audio-volume-muted.svg] FAILED [ 16%]
...
test/test_images.py::TestImg::test_init[/build/qtile/src/qtile-0.14.2/test/data/svg/audio-volume-muted.svg] FAILED [ 17%]
...
test/test_images.py::TestImg::test_from_path[/build/qtile/src/qtile-0.14.2/test/data/svg/audio-volume-muted.svg] FAILED [ 19%]
...
test/test_images.py::TestImg::test_pattern[/build/qtile/src/qtile-0.14.2/test/data/svg/audio-volume-muted.svg] FAILED [ 21%]
...
test/test_images.py::TestImg::test_pattern_rotate[/build/qtile/src/qtile-0.14.2/test/data/svg/audio-volume-muted.svg] FAILED [ 23%]
...
test/test_images2.py::test_svg_scaling[/build/qtile/src/qtile-0.14.2/test/data/svg/audio-volume-muted.svg] FAILED [ 28%]
...
test/widgets/test_battery.py::test_images_good FAILED                    [ 98%]
...
test/widgets/test_volume.py::test_images_good FAILED                     [100%]

This is the failures output:

=================================== FAILURES ===================================
_ test_get_cairo_surface[/build/qtile/src/qtile-0.14.2/test/data/svg/audio-volume-muted.svg] _

path_n_bytes_image = ('/build/qtile/src/qtile-0.14.2/test/data/svg/audio-volume-muted.svg', b'<svg xmlns="http://www.w3.org/2000/svg" viewB...508 3.508 -3.508 -1.492 -1.492 -3.508 3.508 z" style="fill:#ececec;opacity:0.4;fill-opacity:1;color:#000"/>\n</svg>\n')

    def test_get_cairo_surface(path_n_bytes_image):
        path, bytes_image = path_n_bytes_image
>       surf_info = images.get_cairo_surface(bytes_image)

test/test_images.py:49: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

bytes_img = b'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">\n <g transform="translate(1,1)" style="fill:#ececec;fil....508 3.508 -3.508 -1.492 -1.492 -3.508 3.508 z" style="fill:#ececec;opacity:0.4;fill-opacity:1;color:#000"/>\n</svg>\n'
width = None, height = None

    def get_cairo_surface(bytes_img, width=None, height=None):
        try:
            surf = cairocffi.ImageSurface.create_from_png(io.BytesIO(bytes_img))
            return _SurfaceInfo(surf, 'png')
        except (MemoryError, OSError):
            pass
        try:
            return _decode_to_image_surface(bytes_img, width, height)
        except cairocffi.pixbuf.ImageLoadingError:
            pass
>       raise LoadingError("Couldn't load image!")
E       libqtile.images.LoadingError: Couldn't load image!

libqtile/images.py:58: LoadingError
_ TestImg.test_init[/build/qtile/src/qtile-0.14.2/test/data/svg/audio-volume-muted.svg] _

self = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d598bc18>

    @property
    def surface(self):
        try:
>           return self._surface
E           AttributeError: 'Img' object has no attribute '_surface'

libqtile/images.py:258: AttributeError

During handling of the above exception, another exception occurred:

self = <libqtile.images._PixelSize object at 0x6f43d6d624e0>
obj = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d598bc18>
cls = <class 'libqtile.images.Img'>

    def __get__(self, obj, cls):
        if obj is None:
            return self
        _getattr = getattr
        try:
>           return _getattr(obj, self.under_name)
E           AttributeError: 'Img' object has no attribute '_width'

libqtile/images.py:111: AttributeError

During handling of the above exception, another exception occurred:

self = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d598bc18>

    @property
    def default_size(self):
        try:
>           return self._default_size
E           AttributeError: 'Img' object has no attribute '_default_size'

libqtile/images.py:197: AttributeError

During handling of the above exception, another exception occurred:

self = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d598bc18>

    @property
    def default_surface(self):
        try:
>           return self._default_surface
E           AttributeError: 'Img' object has no attribute '_default_surface'

libqtile/images.py:188: AttributeError

During handling of the above exception, another exception occurred:

self = <test.test_images.TestImg object at 0x6f43d598b4a8>
path_n_bytes_image = ('/build/qtile/src/qtile-0.14.2/test/data/svg/audio-volume-muted.svg', b'<svg xmlns="http://www.w3.org/2000/svg" viewB...508 3.508 -3.508 -1.492 -1.492 -3.508 3.508 z" style="fill:#ececec;opacity:0.4;fill-opacity:1;color:#000"/>\n</svg>\n')

    def test_init(self, path_n_bytes_image):
        path, bytes_image = path_n_bytes_image
        img = images.Img(bytes_image)
>       assert isinstance(img.surface, cairocffi.ImageSurface)

test/test_images.py:69: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
libqtile/images.py:260: in surface
    surf, fmt = get_cairo_surface(self.bytes_img, self.width, self.height)
libqtile/images.py:113: in __get__
    return self.get_default(obj)
libqtile/images.py:137: in get_default
    size = obj.default_size
libqtile/images.py:199: in default_size
    surf = self.default_surface
libqtile/images.py:190: in default_surface
    surf, fmt = get_cairo_surface(self.bytes_img)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

bytes_img = b'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">\n <g transform="translate(1,1)" style="fill:#ececec;fil....508 3.508 -3.508 -1.492 -1.492 -3.508 3.508 z" style="fill:#ececec;opacity:0.4;fill-opacity:1;color:#000"/>\n</svg>\n'
width = None, height = None

    def get_cairo_surface(bytes_img, width=None, height=None):
        try:
            surf = cairocffi.ImageSurface.create_from_png(io.BytesIO(bytes_img))
            return _SurfaceInfo(surf, 'png')
        except (MemoryError, OSError):
            pass
        try:
            return _decode_to_image_surface(bytes_img, width, height)
        except cairocffi.pixbuf.ImageLoadingError:
            pass
>       raise LoadingError("Couldn't load image!")
E       libqtile.images.LoadingError: Couldn't load image!

libqtile/images.py:58: LoadingError
_ TestImg.test_from_path[/build/qtile/src/qtile-0.14.2/test/data/svg/audio-volume-muted.svg] _

self = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d59862e8>

    @property
    def surface(self):
        try:
>           return self._surface
E           AttributeError: 'Img' object has no attribute '_surface'

libqtile/images.py:258: AttributeError

During handling of the above exception, another exception occurred:

self = <libqtile.images._PixelSize object at 0x6f43d6d624e0>
obj = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d59862e8>
cls = <class 'libqtile.images.Img'>

    def __get__(self, obj, cls):
        if obj is None:
            return self
        _getattr = getattr
        try:
>           return _getattr(obj, self.under_name)
E           AttributeError: 'Img' object has no attribute '_width'

libqtile/images.py:111: AttributeError

During handling of the above exception, another exception occurred:

self = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d59862e8>

    @property
    def default_size(self):
        try:
>           return self._default_size
E           AttributeError: 'Img' object has no attribute '_default_size'

libqtile/images.py:197: AttributeError

During handling of the above exception, another exception occurred:

self = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d59862e8>

    @property
    def default_surface(self):
        try:
>           return self._default_surface
E           AttributeError: 'Img' object has no attribute '_default_surface'

libqtile/images.py:188: AttributeError

During handling of the above exception, another exception occurred:

self = <test.test_images.TestImg object at 0x6f43d5986b00>
path_n_bytes_image = ('/build/qtile/src/qtile-0.14.2/test/data/svg/audio-volume-muted.svg', b'<svg xmlns="http://www.w3.org/2000/svg" viewB...508 3.508 -3.508 -1.492 -1.492 -3.508 3.508 z" style="fill:#ececec;opacity:0.4;fill-opacity:1;color:#000"/>\n</svg>\n')

    def test_from_path(self, path_n_bytes_image):
        path, bytes_image = path_n_bytes_image
        img = images.Img(bytes_image)
>       assert isinstance(img.surface, cairocffi.ImageSurface)

test/test_images.py:76: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
libqtile/images.py:260: in surface
    surf, fmt = get_cairo_surface(self.bytes_img, self.width, self.height)
libqtile/images.py:113: in __get__
    return self.get_default(obj)
libqtile/images.py:137: in get_default
    size = obj.default_size
libqtile/images.py:199: in default_size
    surf = self.default_surface
libqtile/images.py:190: in default_surface
    surf, fmt = get_cairo_surface(self.bytes_img)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

bytes_img = b'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">\n <g transform="translate(1,1)" style="fill:#ececec;fil....508 3.508 -3.508 -1.492 -1.492 -3.508 3.508 z" style="fill:#ececec;opacity:0.4;fill-opacity:1;color:#000"/>\n</svg>\n'
width = None, height = None

    def get_cairo_surface(bytes_img, width=None, height=None):
        try:
            surf = cairocffi.ImageSurface.create_from_png(io.BytesIO(bytes_img))
            return _SurfaceInfo(surf, 'png')
        except (MemoryError, OSError):
            pass
        try:
            return _decode_to_image_surface(bytes_img, width, height)
        except cairocffi.pixbuf.ImageLoadingError:
            pass
>       raise LoadingError("Couldn't load image!")
E       libqtile.images.LoadingError: Couldn't load image!

libqtile/images.py:58: LoadingError
_ TestImg.test_pattern[/build/qtile/src/qtile-0.14.2/test/data/svg/audio-volume-muted.svg] _

self = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d595d438>

    @property
    def pattern(self):
        try:
>           return self._pattern
E           AttributeError: 'Img' object has no attribute '_pattern'

libqtile/images.py:274: AttributeError

During handling of the above exception, another exception occurred:

self = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d595d438>

    @property
    def surface(self):
        try:
>           return self._surface
E           AttributeError: 'Img' object has no attribute '_surface'

libqtile/images.py:258: AttributeError

During handling of the above exception, another exception occurred:

self = <libqtile.images._PixelSize object at 0x6f43d6d624e0>
obj = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d595d438>
cls = <class 'libqtile.images.Img'>

    def __get__(self, obj, cls):
        if obj is None:
            return self
        _getattr = getattr
        try:
>           return _getattr(obj, self.under_name)
E           AttributeError: 'Img' object has no attribute '_width'

libqtile/images.py:111: AttributeError

During handling of the above exception, another exception occurred:

self = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d595d438>

    @property
    def default_size(self):
        try:
>           return self._default_size
E           AttributeError: 'Img' object has no attribute '_default_size'

libqtile/images.py:197: AttributeError

During handling of the above exception, another exception occurred:

self = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d595d438>

    @property
    def default_surface(self):
        try:
>           return self._default_surface
E           AttributeError: 'Img' object has no attribute '_default_surface'

libqtile/images.py:188: AttributeError

During handling of the above exception, another exception occurred:

self = <test.test_images.TestImg object at 0x6f43d595d7f0>
path_n_bytes_image = ('/build/qtile/src/qtile-0.14.2/test/data/svg/audio-volume-muted.svg', b'<svg xmlns="http://www.w3.org/2000/svg" viewB...508 3.508 -3.508 -1.492 -1.492 -3.508 3.508 z" style="fill:#ececec;opacity:0.4;fill-opacity:1;color:#000"/>\n</svg>\n')

    def test_pattern(self, path_n_bytes_image):
        path, bytes_image = path_n_bytes_image
        img = images.Img(bytes_image)
>       assert isinstance(img.pattern, cairocffi.SurfacePattern)

test/test_images.py:120: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
libqtile/images.py:276: in pattern
    pat = get_cairo_pattern(self.surface, self.width, self.height, self.theta)
libqtile/images.py:260: in surface
    surf, fmt = get_cairo_surface(self.bytes_img, self.width, self.height)
libqtile/images.py:113: in __get__
    return self.get_default(obj)
libqtile/images.py:137: in get_default
    size = obj.default_size
libqtile/images.py:199: in default_size
    surf = self.default_surface
libqtile/images.py:190: in default_surface
    surf, fmt = get_cairo_surface(self.bytes_img)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

bytes_img = b'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">\n <g transform="translate(1,1)" style="fill:#ececec;fil....508 3.508 -3.508 -1.492 -1.492 -3.508 3.508 z" style="fill:#ececec;opacity:0.4;fill-opacity:1;color:#000"/>\n</svg>\n'
width = None, height = None

    def get_cairo_surface(bytes_img, width=None, height=None):
        try:
            surf = cairocffi.ImageSurface.create_from_png(io.BytesIO(bytes_img))
            return _SurfaceInfo(surf, 'png')
        except (MemoryError, OSError):
            pass
        try:
            return _decode_to_image_surface(bytes_img, width, height)
        except cairocffi.pixbuf.ImageLoadingError:
            pass
>       raise LoadingError("Couldn't load image!")
E       libqtile.images.LoadingError: Couldn't load image!

libqtile/images.py:58: LoadingError
_ TestImg.test_pattern_rotate[/build/qtile/src/qtile-0.14.2/test/data/svg/audio-volume-muted.svg] _

self = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d57ec160>

    @property
    def pattern(self):
        try:
>           return self._pattern
E           AttributeError: 'Img' object has no attribute '_pattern'

libqtile/images.py:274: AttributeError

During handling of the above exception, another exception occurred:

self = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d57ec160>

    @property
    def surface(self):
        try:
>           return self._surface
E           AttributeError: 'Img' object has no attribute '_surface'

libqtile/images.py:258: AttributeError

During handling of the above exception, another exception occurred:

self = <libqtile.images._PixelSize object at 0x6f43d6d624e0>
obj = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d57ec160>
cls = <class 'libqtile.images.Img'>

    def __get__(self, obj, cls):
        if obj is None:
            return self
        _getattr = getattr
        try:
>           return _getattr(obj, self.under_name)
E           AttributeError: 'Img' object has no attribute '_width'

libqtile/images.py:111: AttributeError

During handling of the above exception, another exception occurred:

self = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d57ec160>

    @property
    def default_size(self):
        try:
>           return self._default_size
E           AttributeError: 'Img' object has no attribute '_default_size'

libqtile/images.py:197: AttributeError

During handling of the above exception, another exception occurred:

self = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d57ec160>

    @property
    def default_surface(self):
        try:
>           return self._default_surface
E           AttributeError: 'Img' object has no attribute '_default_surface'

libqtile/images.py:188: AttributeError

During handling of the above exception, another exception occurred:

self = <test.test_images.TestImg object at 0x6f43d57ec828>
path_n_bytes_image = ('/build/qtile/src/qtile-0.14.2/test/data/svg/audio-volume-muted.svg', b'<svg xmlns="http://www.w3.org/2000/svg" viewB...508 3.508 -3.508 -1.492 -1.492 -3.508 3.508 z" style="fill:#ececec;opacity:0.4;fill-opacity:1;color:#000"/>\n</svg>\n')

    def test_pattern_rotate(self, path_n_bytes_image):
        path, bytes_image = path_n_bytes_image
        img = images.Img(bytes_image)
        img.theta = 90.0
        assert img.theta == 90.0
>       t_matrix = img.pattern.get_matrix().as_tuple()

test/test_images.py:140: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
libqtile/images.py:276: in pattern
    pat = get_cairo_pattern(self.surface, self.width, self.height, self.theta)
libqtile/images.py:260: in surface
    surf, fmt = get_cairo_surface(self.bytes_img, self.width, self.height)
libqtile/images.py:113: in __get__
    return self.get_default(obj)
libqtile/images.py:137: in get_default
    size = obj.default_size
libqtile/images.py:199: in default_size
    surf = self.default_surface
libqtile/images.py:190: in default_surface
    surf, fmt = get_cairo_surface(self.bytes_img)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

bytes_img = b'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">\n <g transform="translate(1,1)" style="fill:#ececec;fil....508 3.508 -3.508 -1.492 -1.492 -3.508 3.508 z" style="fill:#ececec;opacity:0.4;fill-opacity:1;color:#000"/>\n</svg>\n'
width = None, height = None

    def get_cairo_surface(bytes_img, width=None, height=None):
        try:
            surf = cairocffi.ImageSurface.create_from_png(io.BytesIO(bytes_img))
            return _SurfaceInfo(surf, 'png')
        except (MemoryError, OSError):
            pass
        try:
            return _decode_to_image_surface(bytes_img, width, height)
        except cairocffi.pixbuf.ImageLoadingError:
            pass
>       raise LoadingError("Couldn't load image!")
E       libqtile.images.LoadingError: Couldn't load image!

libqtile/images.py:58: LoadingError
_ test_svg_scaling[/build/qtile/src/qtile-0.14.2/test/data/svg/audio-volume-muted.svg] _

self = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d57d52e8>

    @property
    def default_size(self):
        try:
>           return self._default_size
E           AttributeError: 'Img' object has no attribute '_default_size'

libqtile/images.py:197: AttributeError

During handling of the above exception, another exception occurred:

self = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d57d52e8>

    @property
    def default_surface(self):
        try:
>           return self._default_surface
E           AttributeError: 'Img' object has no attribute '_default_surface'

libqtile/images.py:188: AttributeError

During handling of the above exception, another exception occurred:

svg_img = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d57d52e8>
distortion_bad = ImgDistortion(AE=33053.0, FUZZ=0.0757355, MAE=0.0183496, MEPP=1108260000.0, MSE=0.00573586, PAE=0.803922, PHASH=61.5351, PSNR=22.414, RMSE=0.0757355)
comparison_images = ('/build/qtile/src/qtile-0.14.2/test/data/comparison_images/audio-volume-muted_bad.png', '/build/qtile/src/qtile-0.14.2/test/data/comparison_images/audio-volume-muted_good.png')
tmpdir = local('/tmp/pytest-of-builduser/pytest-0/test_svg_scaling__build_qtile_0')

    def test_svg_scaling(svg_img, distortion_bad, comparison_images, tmpdir):
        path_bad, path_good = comparison_images
        dpath = tmpdir.dirpath
    
        name = svg_img.name
>       svg_img.scale(width_factor=20, lock_aspect_ratio=True)

test/test_images2.py:120: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
libqtile/images.py:226: in scale
    res = self._scale_lock(width_factor, height_factor, self.default_size)
libqtile/images.py:199: in default_size
    surf = self.default_surface
libqtile/images.py:190: in default_surface
    surf, fmt = get_cairo_surface(self.bytes_img)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

bytes_img = b'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">\n <g transform="translate(1,1)" style="fill:#ececec;fil....508 3.508 -3.508 -1.492 -1.492 -3.508 3.508 z" style="fill:#ececec;opacity:0.4;fill-opacity:1;color:#000"/>\n</svg>\n'
width = None, height = None

    def get_cairo_surface(bytes_img, width=None, height=None):
        try:
            surf = cairocffi.ImageSurface.create_from_png(io.BytesIO(bytes_img))
            return _SurfaceInfo(surf, 'png')
        except (MemoryError, OSError):
            pass
        try:
            return _decode_to_image_surface(bytes_img, width, height)
        except cairocffi.pixbuf.ImageLoadingError:
            pass
>       raise LoadingError("Couldn't load image!")
E       libqtile.images.LoadingError: Couldn't load image!

libqtile/images.py:58: LoadingError
---------------------------- Captured stdout setup -----------------------------
stdout b'33053\n'
stderr b''
cmd ['convert', '/build/qtile/src/qtile-0.14.2/test/data/comparison_images/audio-volume-muted_bad.png', '/build/qtile/src/qtile-0.14.2/test/data/comparison_images/audio-volume-muted_good.png', '-metric', 'AE', '-compare', '-format', '%[distortion]\n', 'info:']
stdout b'0.0757355\n'
stderr b''
cmd ['convert', '/build/qtile/src/qtile-0.14.2/test/data/comparison_images/audio-volume-muted_bad.png', '/build/qtile/src/qtile-0.14.2/test/data/comparison_images/audio-volume-muted_good.png', '-metric', 'FUZZ', '-compare', '-format', '%[distortion]\n', 'info:']
stdout b'0.0183496\n'
stderr b''
cmd ['convert', '/build/qtile/src/qtile-0.14.2/test/data/comparison_images/audio-volume-muted_bad.png', '/build/qtile/src/qtile-0.14.2/test/data/comparison_images/audio-volume-muted_good.png', '-metric', 'MAE', '-compare', '-format', '%[distortion]\n', 'info:']
stdout b'1.10826e+09\n'
stderr b''
cmd ['convert', '/build/qtile/src/qtile-0.14.2/test/data/comparison_images/audio-volume-muted_bad.png', '/build/qtile/src/qtile-0.14.2/test/data/comparison_images/audio-volume-muted_good.png', '-metric', 'MEPP', '-compare', '-format', '%[distortion]\n', 'info:']
stdout b'0.00573586\n'
stderr b''
cmd ['convert', '/build/qtile/src/qtile-0.14.2/test/data/comparison_images/audio-volume-muted_bad.png', '/build/qtile/src/qtile-0.14.2/test/data/comparison_images/audio-volume-muted_good.png', '-metric', 'MSE', '-compare', '-format', '%[distortion]\n', 'info:']
stdout b'0.803922\n'
stderr b''
cmd ['convert', '/build/qtile/src/qtile-0.14.2/test/data/comparison_images/audio-volume-muted_bad.png', '/build/qtile/src/qtile-0.14.2/test/data/comparison_images/audio-volume-muted_good.png', '-metric', 'PAE', '-compare', '-format', '%[distortion]\n', 'info:']
stdout b'61.5351\n'
stderr b''
cmd ['convert', '/build/qtile/src/qtile-0.14.2/test/data/comparison_images/audio-volume-muted_bad.png', '/build/qtile/src/qtile-0.14.2/test/data/comparison_images/audio-volume-muted_good.png', '-metric', 'PHASH', '-compare', '-format', '%[distortion]\n', 'info:']
stdout b'22.414\n'
stderr b''
cmd ['convert', '/build/qtile/src/qtile-0.14.2/test/data/comparison_images/audio-volume-muted_bad.png', '/build/qtile/src/qtile-0.14.2/test/data/comparison_images/audio-volume-muted_good.png', '-metric', 'PSNR', '-compare', '-format', '%[distortion]\n', 'info:']
stdout b'0.0757355\n'
stderr b''
cmd ['convert', '/build/qtile/src/qtile-0.14.2/test/data/comparison_images/audio-volume-muted_bad.png', '/build/qtile/src/qtile-0.14.2/test/data/comparison_images/audio-volume-muted_good.png', '-metric', 'RMSE', '-compare', '-format', '%[distortion]\n', 'info:']
_______________________________ test_images_good _______________________________

self = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d5af3780>

    @property
    def default_size(self):
        try:
>           return self._default_size
E           AttributeError: 'Img' object has no attribute '_default_size'

libqtile/images.py:197: AttributeError

During handling of the above exception, another exception occurred:

self = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d5af3780>

    @property
    def default_surface(self):
        try:
>           return self._default_surface
E           AttributeError: 'Img' object has no attribute '_default_surface'

libqtile/images.py:188: AttributeError

During handling of the above exception, another exception occurred:

tmpdir = local('/tmp/pytest-of-builduser/pytest-0/test_images_good0')
fake_bar = <libqtile.bar.Bar object at 0x6f43d5a7e0b8>
svg_img_as_pypath = local('/build/qtile/src/qtile-0.14.2/test/data/svg/audio-volume-muted.svg')

    def test_images_good(tmpdir, fake_bar, svg_img_as_pypath):
        """Test BatteryIcon() with a good theme_path
    
        This theme path does contain all of the required images.
        """
        for name in BatteryIcon.icon_names:
            target = tmpdir.join(name + '.svg')
            svg_img_as_pypath.copy(target)
    
        batt = BatteryIcon(theme_path=str(tmpdir))
        batt.fontsize = 12
        batt.bar = fake_bar
>       batt.setup_images()

test/widgets/test_battery.py:194: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
libqtile/widget/battery.py:473: in setup_images
    img.resize(height=new_height)
libqtile/images.py:209: in resize
    width0, height0 = self.default_size
libqtile/images.py:199: in default_size
    surf = self.default_surface
libqtile/images.py:190: in default_surface
    surf, fmt = get_cairo_surface(self.bytes_img)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

bytes_img = b'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">\n <g transform="translate(1,1)" style="fill:#ececec;fil....508 3.508 -3.508 -1.492 -1.492 -3.508 3.508 z" style="fill:#ececec;opacity:0.4;fill-opacity:1;color:#000"/>\n</svg>\n'
width = None, height = None

    def get_cairo_surface(bytes_img, width=None, height=None):
        try:
            surf = cairocffi.ImageSurface.create_from_png(io.BytesIO(bytes_img))
            return _SurfaceInfo(surf, 'png')
        except (MemoryError, OSError):
            pass
        try:
            return _decode_to_image_surface(bytes_img, width, height)
        except cairocffi.pixbuf.ImageLoadingError:
            pass
>       raise LoadingError("Couldn't load image!")
E       libqtile.images.LoadingError: Couldn't load image!

libqtile/images.py:58: LoadingError
_______________________________ test_images_good _______________________________

self = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d58e1748>

    @property
    def default_size(self):
        try:
>           return self._default_size
E           AttributeError: 'Img' object has no attribute '_default_size'

libqtile/images.py:197: AttributeError

During handling of the above exception, another exception occurred:

self = <[LoadingError("Couldn't load image!") raised in repr()] Img object at 0x6f43d58e1748>

    @property
    def default_surface(self):
        try:
>           return self._default_surface
E           AttributeError: 'Img' object has no attribute '_default_surface'

libqtile/images.py:188: AttributeError

During handling of the above exception, another exception occurred:

tmpdir = local('/tmp/pytest-of-builduser/pytest-0/test_images_good1')
fake_bar = <libqtile.bar.Bar object at 0x6f43d58e1470>
svg_img_as_pypath = local('/build/qtile/src/qtile-0.14.2/test/data/svg/audio-volume-muted.svg')

    def test_images_good(tmpdir, fake_bar, svg_img_as_pypath):
        names = (
            'audio-volume-high.svg',
            'audio-volume-low.svg',
            'audio-volume-medium.svg',
            'audio-volume-muted.svg',
        )
        for name in names:
            target = tmpdir.join(name)
            svg_img_as_pypath.copy(target)
    
        vol = Volume(theme_path=str(tmpdir))
        vol.bar = fake_bar
>       vol.setup_images()

test/widgets/test_volume.py:27: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
libqtile/widget/volume.py:181: in setup_images
    img.resize(height=new_height)
libqtile/images.py:209: in resize
    width0, height0 = self.default_size
libqtile/images.py:199: in default_size
    surf = self.default_surface
libqtile/images.py:190: in default_surface
    surf, fmt = get_cairo_surface(self.bytes_img)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

bytes_img = b'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">\n <g transform="translate(1,1)" style="fill:#ececec;fil....508 3.508 -3.508 -1.492 -1.492 -3.508 3.508 z" style="fill:#ececec;opacity:0.4;fill-opacity:1;color:#000"/>\n</svg>\n'
width = None, height = None

    def get_cairo_surface(bytes_img, width=None, height=None):
        try:
            surf = cairocffi.ImageSurface.create_from_png(io.BytesIO(bytes_img))
            return _SurfaceInfo(surf, 'png')
        except (MemoryError, OSError):
            pass
        try:
            return _decode_to_image_surface(bytes_img, width, height)
        except cairocffi.pixbuf.ImageLoadingError:
            pass
>       raise LoadingError("Couldn't load image!")
E       libqtile.images.LoadingError: Couldn't load image!

libqtile/images.py:58: LoadingError
=============================== warnings summary ===============================
test/test_bar.py::test_incompatible_widget
test/test_bar.py::test_multiple_stretches
  /build/qtile/src/qtile-0.14.2/test/conftest.py:289: PytestDeprecationWarning: the `pytest.config` global is deprecated.  Please use `request.config` or `pytest_configure` (if you're a pytest plugin) instead.
    llvl = logging.DEBUG if pytest.config.getoption("--debuglog") else logging.INFO

-- Docs: https://docs.pytest.org/en/latest/warnings.html
======= 8 failed, 317 passed, 53 skipped, 2 warnings in 2826.44 seconds ========

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
jayvdbcommented, Oct 26, 2020

I got that test working in .spec with cp %{buildroot}%{_bindir}/qtile-cmd ./bin/ where `.`` is it PyPI sdist root

0reactions
dvzrvcommented, Feb 17, 2021

After a long discussion round on this topic on IRC, I have finally been able to figure out, why the tests are failing: It looks as if librsvg is required for the tests and most likely also during runtime of qtile, for the loading of svg files.

Unfortunately, none of the current dependencies pull in librsvg (not even optionally) and I wonder how it is pulled in in the CI environment, but my assumption is it is via gir1.2-gtk-3.0.

On Arch we don’t have e.g. an optional dependency on gtk3 (which would pull in librsvg) for python-gobject, indicating this similar link and meet the dependency.

I will add librsvg as a dependency for qtile for the time being and try to figure out an improvement for the python-gobject/gtk3 situation on Arch.

I have to admit, that even after sieving through cairo (which is somehow able to load svg via libpng), python-cairocffi, gdk-pixbuf and rebuilding half of it for good measure, I am not much closer to understanding where exactly librsvg is actually coming into play.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found