-
Notifications
You must be signed in to change notification settings - Fork 55
Add support for service blocking #85
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 support for service blocking #85
Conversation
6c0c8ad
to
028656f
Compare
I figured out how to test at least the changes in |
This looks good - I don't have any suggested changes. For testing, it would be great if you could add some. These are quite tricky though because you can't actually wait any noticeable amount of time, and there are race conditions. Here's what I'd recommend. For
I don't see a good way to test For |
Let me know what you think of the tests I added. We don't actually have to test that the function blocks since that is Home Assistant's job, we just need to make sure that the appropriate params get passed to |
65e37b6
to
1dfab0f
Compare
Do you think this is ready now? I'm happy to try adding the couple of tests I proposed. Your tests look good too. |
Yes I feel good about this PR now, but if you would like to add some tests that actually test the blocking please do. I think I understand what you are proposing but you would probably be able to add the tests faster |
Great - thanks. Merged. |
I added some additional tests in a25063d. |
Great, thank you! |
I have created several functions in
pyscript
that make calls to other services. I could usetask.wait_until
to block execution until the service is finished running, but it seems more convenient to be able to specify that in the service call directly. As such, I have added support for theblocking
andlimit
parameters which will give users more control over the service call behavior.I am unsure how to test this - I'd be happy to add tests if you have some ideas on the best way to do that.