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

Refactoring Notification preferences #1655

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

Conversation

kenmaca
Copy link

@kenmaca kenmaca commented Jun 27, 2023

Follow up to #1653 and comments around refactoring _check_cascading_vars to lift watch.get('notification_muted') out into send_content_changed_notification instead.

I renamed the function and put some time into cleaning up the function itself to be more concise, if you don't mind. It's been awhile since I've written anything in Python!

@dgtlmoon
Copy link
Owner

@kenmaca nice rename there of the function, makes more sense (although see my OO related comment)

You got a test failure :-) in tests/test_add_replace_remove_filter.py::test_check_add_line_contains_trigger not sure what the exception is, the logging is not amazing.. but the notification was never fired anyway


return None
# Cascades to the first setting (ie, closest to the individual watch settings) that's defined
return next(
Copy link
Owner

Choose a reason for hiding this comment

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

return next( hmm I'll have to rtfm about next

@dgtlmoon
Copy link
Owner

The other thing that would be amazing to add is a test case that covers atleast part of the notification preferences chain, at the moment the tests only cover doing it exactly with globals, or exactly per-watch etc, never a mixed case... if you wanted to add some test here I would be very grateful

@kenmaca
Copy link
Author

kenmaca commented Jun 28, 2023

Another reason why tests are amazing, they caught my mistake. When there aren't any settings resolved by any layer, next throws StopIterator. I assumed it returned None, so I added the default param to fix the failed tests.

It's been awhile since I've written pytests, so I'll find some time this week to relearn it and update the PR. Thanks!

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.

None yet

2 participants