-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add unit tests and CI #124
Conversation
Thanks for helping out with this. Not super familiar with pytest but the test code looks good to me so far! |
I'm also planning on implementing some integration tests for the project soon as well so that'll probably be in the build/test action anyway, filling the role @akdev1l was mentioning |
- Add basic pytest unit tests - Add unit test Actions CI workflow
mock_cfg.dbus_notify = True | ||
mock_os.getuid.return_value = 1001 | ||
notify(title, body) | ||
mock_run.assert_called_once_with( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of checking to see if the command has been ran properly, but this could also be a problem down the line if someone changes the arguments or if notify-send changes its cli. This also goes for a lot of these other subprocess calls. Testing subprocess is hard though and likely will need to be solved by integration tests down the line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ya its definitely tricky. the trap with unit tests at times is asserting too much as it makes the tests more inflexible and requires more maintenance on them. I could reduce the number of assertions to a more simple input -> output format that would allow changes to not break the tests as much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but at the end of the day the unit tests are there to maintain stability of the codebase. changes to the unit tests are a often occurrence in my experience
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me then! Subprocess is a tricky one but after mulling it over it's probably better than not to at least test the arguments being passed in. Thanks so much for the great work here!
This PR contains the following changes:
Closes #72