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

Allow to skip interactive tests & fix of test #133

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cmhe
Copy link

@cmhe cmhe commented Oct 24, 2022

This allows to skip interactive test cases and fixes the test_menu_construct_from_none test case.

cmhe added 2 commits October 24, 2022 11:44
When `menu(None)` is called, this exception happens:

  File "/tmp/pystray-0.19.4/lib/pystray/_base.py", line 661, in cleaned
    if not i.visible:
  AttributeError: 'NoneType' object has no attribute 'visible'

Adding an `not i or` before that condition will make sure that `None`
will be considered as not visible.

The test itself fails as well:

  File "/tmp/pystray-0.19.4/tests/menu_descriptor_tests.py", line 85, in test_menu_construct_from_none
    self.assertEqual(
  AssertionError: '' != '\n'

Instead just compare if `str(menu(None))` is the empty string.
Interactive tests cannot be executed in automated test environments.

This adds a way to skip those tests via setting the `TEST_SKIP_INTERACTIVE`
variable to `1`.
Copy link

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've cherry-picked Fix test_menu_construct_from_none test case into the nixpkgs package and it fixes the test for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants