Bug 1348872 - Wait() should accept None as timeout and interval.
Setting the default value for both the timeout and interval should not
be done in the parameter list, but dependent on if None is passed in
or not.
MozReview-Commit-ID: 4VwHfTkrwDk
--- a/testing/marionette/client/marionette_driver/wait.py
+++ b/testing/marionette/client/marionette_driver/wait.py
@@ -24,18 +24,18 @@ class Wait(object):
condition, as well as the frequency with which to check the
condition. Furthermore, the user may configure the wait to ignore
specific types of exceptions whilst waiting, such as
`errors.NoSuchElementException` when searching for an element on
the page.
"""
- def __init__(self, marionette, timeout=DEFAULT_TIMEOUT,
- interval=DEFAULT_INTERVAL, ignored_exceptions=None,
+ def __init__(self, marionette, timeout=None,
+ interval=None, ignored_exceptions=None,
clock=None):
"""Configure the Wait instance to have a custom timeout, interval, and
list of ignored exceptions. Optionally a different time
implementation than the one provided by the standard library
(time) can also be provided.
Sample usage::
@@ -66,20 +66,20 @@ class Wait(object):
:param clock: Allows overriding the use of the runtime's
default time library. See `wait.SystemClock` for
implementation details.
"""
self.marionette = marionette
- self.timeout = timeout
+ self.timeout = timeout if timeout is not None else DEFAULT_TIMEOUT
+ self.interval = interval if interval is not None else DEFAULT_INTERVAL
self.clock = clock or SystemClock()
self.end = self.clock.now + self.timeout
- self.interval = interval
exceptions = []
if ignored_exceptions is not None:
if isinstance(ignored_exceptions, collections.Iterable):
exceptions.extend(iter(ignored_exceptions))
else:
exceptions.append(ignored_exceptions)
self.exceptions = tuple(set(exceptions))