Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

desktop_notification.py tests are failing with AttributeError during compile #2770

Closed
m500s opened this issue Jan 16, 2025 · 4 comments
Closed
Labels

Comments

@m500s
Copy link

m500s commented Jan 16, 2025

Hi, I'm using the git clone as of 1/10/25.
I was getting five tests desktop_notifications failing as of the 1.1.14 release, but some of these were fixed with the recent commits
Please let me know if any more information is needed.

  • Distribution: Oracle Linux 9

  • Errors or warnings from Solaar:

+ /usr/bin/pytest
==================================================================================== test session starts =====================================================================================
platform linux -- Python 3.9.21, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/--/rpmbuild/BUILD/Solaar-1.1.14
plugins: forked-1.4.0, cov-4.0.0, hypothesis-6.39.1, xdist-2.5.0, mock-3.6.1
collected 656 items                                                                                                                                                                          

tests/hid_parser/test_data.py ..                                                                                                                                                       [  0%]
tests/hidapi/test_hidapi.py .                                                                                                                                                          [  0%]
tests/logitech_receiver/test_base.py ................................                                                                                                                  [  5%]
tests/logitech_receiver/test_base_usb.py ...                                                                                                                                           [  5%]
tests/logitech_receiver/test_common.py ................................                                                                                                                [ 10%]
tests/logitech_receiver/test_desktop_notifications.py ..F                                                                                                                              [ 11%]
tests/logitech_receiver/test_device.py .....................................                                                                                                           [ 16%]
tests/logitech_receiver/test_diversion.py ..........                                                                                                                                   [ 18%]
tests/logitech_receiver/test_hidpp10.py ...................................................                                                                                            [ 26%]
tests/logitech_receiver/test_hidpp20_complex.py ......................................................................................................                                 [ 41%]
tests/logitech_receiver/test_hidpp20_simple.py ........................................................................                                                                [ 52%]
tests/logitech_receiver/test_notifications.py ..................................................................                                                                       [ 62%]
tests/logitech_receiver/test_receiver.py ..................................                                                                                                            [ 67%]
tests/logitech_receiver/test_setting_templates.py .................................................................................................................................... [ 87%]
.............                                                                                                                                                                          [ 89%]
tests/logitech_receiver/test_settings_validator.py ...........                                                                                                                         [ 91%]
tests/solaar/test_gtk.py ...                                                                                                                                                           [ 92%]
tests/solaar/ui/test_about_dialog.py ..                                                                                                                                                [ 92%]
tests/solaar/ui/test_common.py ...                                                                                                                                                     [ 92%]
tests/solaar/ui/test_desktop_notifications.py ...F                                                                                                                                     [ 93%]
tests/solaar/ui/test_i18n.py s                                                                                                                                                         [ 93%]
tests/solaar/ui/test_pair_window.py ssssss......ssssssssssssssssssss.....sss                                                                                                           [ 99%]
tests/solaar/ui/test_probe.py .                                                                                                                                                        [ 99%]
tests/test_keysyms/test_keysymdef.py .                                                                                                                                                 [100%]

========================================================================================== FAILURES ==========================================================================================
_________________________________________________________________________________________ test_show __________________________________________________________________________________________

    def test_show():
        dev = MockDevice()
        reason = "unknown"
>       result = desktop_notifications.show(dev, reason)

tests/logitech_receiver/test_desktop_notifications.py:28: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/solaar-1.1.14-0.el9.x86_64/usr/lib/python3.9/site-packages/logitech_receiver/desktop_notifications.py:84: in show
    icon_name = device_icon_name(dev.name, dev.kind) if icon is None else icon
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'MockDevice', kind = <MockDevice name='mock.kind' id='140392564674320'>

    def device_icon_name(name, kind=None):
        _default_theme = Gtk.IconTheme.get_default()
        icon_list = device_icon_list(name, kind)
        for n in reversed(icon_list):
>           if _default_theme.has_icon(n):
E           AttributeError: 'NoneType' object has no attribute 'has_icon'

../../BUILDROOT/solaar-1.1.14-0.el9.x86_64/usr/lib/python3.9/site-packages/logitech_receiver/desktop_notifications.py:117: AttributeError
------------------------------------------------------------------------------------ Captured stderr call ------------------------------------------------------------------------------------

(pytest:213284): Gtk-CRITICAL **: 18:02:02.345: gtk_icon_theme_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed
_________________________________________________________________________________________ test_show __________________________________________________________________________________________

    def test_show():
        dev = MockDevice()
        reason = "unknown"
        available = desktop_notifications.init()
    
>       result = desktop_notifications.show(dev, reason)

tests/solaar/ui/test_desktop_notifications.py:35: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../BUILDROOT/solaar-1.1.14-0.el9.x86_64/usr/lib/python3.9/site-packages/solaar/ui/desktop_notifications.py:116: in show
    icon_file = icons.device_icon_file(dev.name, dev.kind) if icon is None else icons.icon_file(icon)
../../BUILDROOT/solaar-1.1.14-0.el9.x86_64/usr/lib/python3.9/site-packages/solaar/ui/icons.py:113: in device_icon_file
    icon_name = device_icon_name(name, kind)
../../BUILDROOT/solaar-1.1.14-0.el9.x86_64/usr/lib/python3.9/site-packages/solaar/ui/icons.py:118: in device_icon_name
    _init_icon_paths()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def _init_icon_paths():
        global _default_theme
        if _default_theme:
            return
    
        _default_theme = Gtk.IconTheme.get_default()
>       logger.debug("icon theme paths: %s", _default_theme.get_search_path())
E       AttributeError: 'NoneType' object has no attribute 'get_search_path'

../../BUILDROOT/solaar-1.1.14-0.el9.x86_64/usr/lib/python3.9/site-packages/solaar/ui/icons.py:40: AttributeError
------------------------------------------------------------------------------------ Captured stderr call ------------------------------------------------------------------------------------

(pytest:213284): Gtk-CRITICAL **: 18:02:02.694: gtk_icon_theme_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed
================================================================================== short test summary info ===================================================================================
FAILED tests/logitech_receiver/test_desktop_notifications.py::test_show - AttributeError: 'NoneType' object has no attribute 'has_icon'
FAILED tests/solaar/ui/test_desktop_notifications.py::test_show - AttributeError: 'NoneType' object has no attribute 'get_search_path'
========================================================================= 2 failed, 624 passed, 30 skipped in 0.72s ==========================================================================

Describe the bug
AttributeError from the desktop_notification.py tests in both logitech_receiver/ and solaar/ui/

To Reproduce
Build solaar using rpmbuild with the solaar-1.1.14-7.fc41.src.rpm and the git source (2 desktop notification tests fails (above))
Build solaar using rpmbuild with the solaar-1.1.14-7.fc41.src.rpm (5 desktop notification tests fails)

@m500s m500s added the bug label Jan 16, 2025
@pfps
Copy link
Collaborator

pfps commented Jan 21, 2025

It looks as if something is not being set up correctly for when you run tests.

The Solaar test suite is not comprehensive and is mostly used for regression testing when developing. It is not necessary to run it on a normal installation.

@m500s
Copy link
Author

m500s commented Jan 21, 2025

Ok, I understand. The pytests have been added to the rpm spec file since 1.1.12 and this was the first time I've had errors thrown up. I just built it without the tests with no problems.

I did notice one difference when clicking on about solaar, the icon is missing there. So maybe the test is catching something. This is not really an issue, so I'll let you decide whether to leave this open or close it out. Thanks for checking this out.

Image

Image


Just for reference in case this is useful for someone later, two new packages were required for the 1.1.14 build from the 1.1.13 build: python3-pytest-cov and python3-hid-parser. Also, the solaar-use-system-hid-parser.patch was dropped.

@pfps
Copy link
Collaborator

pfps commented Jan 21, 2025

PR #2771 might fix the logo problem.

@m500s
Copy link
Author

m500s commented Jan 21, 2025

That fixed it, all good now. Thanks again.

Image

@m500s m500s closed this as completed Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants