Revision: 166
Author: janne.t.harkonen
Date: Mon Aug 27 05:06:42 2012
Log: write_until_expected: accept also time strings a timeout/interval
http://code.google.com/p/robotframework-sshlibrary/source/detail?r=166
Modified:
/trunk/src/SSHLibrary/client.py
/trunk/src/SSHLibrary/library.py
=======================================
--- /trunk/src/SSHLibrary/client.py Sun Aug 26 21:30:21 2012
+++ /trunk/src/SSHLibrary/client.py Mon Aug 27 05:06:42 2012
@@ -201,16 +201,19 @@
:param str text: Text to be written using #write_bare().
:param str expected: Text to look for in the output.
:param int timeout: The timeout during which `expected` must appear
- in the output, in seconds.
- :param int interval: Time to wait between repeated writings'
+ in the output. Can be defined either as seconds or as a Robot
+ Framework time string, e.g. 1 minute 20 seconds.
+ :param int interval: Time to wait between repeated writings. Can be
+ defined similarly as `timeout`.
"""
timeout = TimeEntry(timeout)
+ interval = TimeEntry(interval)
starttime = time.time()
while time.time() - starttime < timeout.value:
self.write(text)
try:
return self._read_until(lambda s: expected in s,
- expected, timeout=interval)
+ expected, timeout=interval.value)
except SSHClientException:
pass
raise SSHClientException("No match found for '%s' in %s."
=======================================
--- /trunk/src/SSHLibrary/library.py Sun Aug 26 21:30:21 2012
+++ /trunk/src/SSHLibrary/library.py Mon Aug 27 05:06:42 2012
@@ -437,8 +437,6 @@
the keyword will fail if 'myprocess' does not appear on the output
in
5 seconds.
"""
- timeout = utils.timestr_to_secs(timeout)
- retry_interval = utils.timestr_to_secs(retry_interval)
reader = lambda: self.ssh_client.write_until_expected(
text, expected, timeout, retry_interval)
self._read_and_log(reader, loglevel)