-
Notifications
You must be signed in to change notification settings - Fork 101
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
wait_until: Add ignored_exceptions
parameter
#441
base: main
Are you sure you want to change the base?
Conversation
N.B. The name is consistent with Selenium's WebDriverWait which also has an |
c113084
to
cc674ff
Compare
Rebased on top of #444. |
Useful if you've started an HTTP server in a background thread and you're waiting for it to start up by trying to connect to it; or you've just sent a key-press to the device-under-test and the FrameObject you're waiting for doesn't handle unknown states very well; etc.
cc674ff
to
f6b099d
Compare
Rebased onto master after merging #444. |
predicate_value = predicate(value) | ||
try: | ||
value = callable_() | ||
except ignored_exceptions as e: |
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 works?!? Fancy that, I guess it makes sense.
value = callable_() | ||
predicate_value = predicate(value) | ||
try: | ||
value = callable_() |
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.
Could this be
try:
value = callable_()
predicate_value = predicate(value)
except ...
and then you could avoid the else:
block and the second try...except
?
Unless this has something to do with not setting value = None
if predicate fails?
i'd like a little bit more discussion of use-cases here. Can you provide an example of where this would have been useful? |
We'll need to test that it raises (or returns None?) if the callable continues to raise exceptions after the timeout. |
Useful if you've started an HTTP server in a background thread and
you're waiting for it to start up by trying to connect to it; or you've
just sent a key-press to the device-under-test and the FrameObject
you're waiting for doesn't handle unknown states very well; etc.
TODO:
predicate
parameter #444.logging
withexcinfo=True
.