2 new revisions:
Revision: 859bb859ebc2
Branch: default
Author: Jussi Malinen <jussi.ao.mali...@gmail.com>
Date: Tue Sep 17 08:41:56 2013 UTC
Log: add output to exception message in telnetlib
http://code.google.com/p/robotframework/source/detail?r=859bb859ebc2
Revision: def0ef00ccc5
Branch: default
Author: Jussi Malinen <jussi.ao.mali...@gmail.com>
Date: Tue Sep 17 08:42:04 2013 UTC
Log: Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=def0ef00ccc5
==============================================================================
Revision: 859bb859ebc2
Branch: default
Author: Jussi Malinen <jussi.ao.mali...@gmail.com>
Date: Tue Sep 17 08:41:56 2013 UTC
Log: add output to exception message in telnetlib
http://code.google.com/p/robotframework/source/detail?r=859bb859ebc2
Modified:
/src/robot/libraries/Telnet.py
=======================================
--- /src/robot/libraries/Telnet.py Sun Jun 9 10:46:45 2013 UTC
+++ /src/robot/libraries/Telnet.py Tue Sep 17 08:41:56 2013 UTC
@@ -38,7 +38,6 @@
- `Importing`
- `Logging`
- `Time string format`
- - `Importing`
- `Shortcuts`
- `Keywords`
@@ -638,7 +637,7 @@
return self.read_until(expected, loglevel)
except AssertionError:
pass
- self._raise_no_match_found(expected, timeout)
+ self._raise_no_match_found(expected, timeout=timeout)
def read(self, loglevel=None):
"""Reads everything that is currently available in the output.
@@ -664,7 +663,7 @@
success, output = self._read_until(expected)
self._log(output, loglevel)
if not success:
- self._raise_no_match_found(expected)
+ self._raise_no_match_found(expected, output=output)
return output
def _read_until(self, expected):
@@ -708,7 +707,7 @@
if not success:
expected = [exp if isinstance(exp, basestring) else exp.pattern
for exp in expected]
- self._raise_no_match_found(expected)
+ self._raise_no_match_found(expected, output=output)
return output
def _read_until_regexp(self, *expected):
@@ -785,11 +784,9 @@
if msg:
logger.write(msg, level or self._default_log_level)
- def _raise_no_match_found(self, expected, timeout=None):
+ def _raise_no_match_found(self, expected, timeout=None, output=None):
timeout = utils.secs_to_timestr(timeout or self._timeout)
- expected = "'%s'" % expected if isinstance(expected, basestring) \
- else utils.seq2str(expected, lastsep=' or ')
- raise AssertionError("No match found for %s in %s" % (expected,
timeout))
+ raise NoMatchError(expected, timeout, output)
def _negotiate_echo_on(self, sock, cmd, opt):
# This is supposed to turn server side echoing on and turn other
options off.
@@ -804,3 +801,20 @@
def msg(self, msg, *args):
# Forward telnetlib's debug messages to log
logger.trace(lambda: msg % args)
+
+
+class NoMatchError(AssertionError):
+
+ def __init__(self, expected, timeout, output=None):
+ self.expected = expected
+ self.timeout = timeout
+ self.output = output
+ AssertionError.__init__(self, self._get_message())
+
+ def _get_message(self):
+ expected = "'%s'" % self.expected if isinstance(self.expected,
basestring) \
+ else utils.seq2str(self.expected, lastsep=' or ')
+ msg = "No match found for %s in %s." % (expected, self.timeout)
+ if self.output:
+ msg += '\nOutput:%s' % self.output
+ raise AssertionError(msg)
==============================================================================
Revision: def0ef00ccc5
Branch: default
Author: Jussi Malinen <jussi.ao.mali...@gmail.com>
Date: Tue Sep 17 08:42:04 2013 UTC
Log: Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=def0ef00ccc5
--
---
You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.