3 new revisions:
Revision: 959841f0a028
Branch: default
Author: Jussi Malinen <jussi.ao.mali...@gmail.com>
Date: Tue Sep 17 12:08:39 2013 UTC
Log: add support for ROBOT_SUPPRESS_NAME to remove exception name from
erro...
http://code.google.com/p/robotframework/source/detail?r=959841f0a028
Revision: f4cc9bba2e94
Branch: default
Author: Jussi Malinen <jussi.ao.mali...@gmail.com>
Date: Tue Sep 17 12:11:40 2013 UTC
Log: fix telnet tests and trace messages
http://code.google.com/p/robotframework/source/detail?r=f4cc9bba2e94
Revision: c59cff0b796a
Branch: default
Author: Jussi Malinen <jussi.ao.mali...@gmail.com>
Date: Tue Sep 17 12:23:50 2013 UTC
Log: cleanup telnet error messages and tests
http://code.google.com/p/robotframework/source/detail?r=c59cff0b796a
==============================================================================
Revision: 959841f0a028
Branch: default
Author: Jussi Malinen <jussi.ao.mali...@gmail.com>
Date: Tue Sep 17 12:08:39 2013 UTC
Log: add support for ROBOT_SUPPRESS_NAME to remove exception name from
error message
http://code.google.com/p/robotframework/source/detail?r=959841f0a028
Modified:
/src/robot/utils/error.py
=======================================
--- /src/robot/utils/error.py Thu Jun 6 14:00:44 2013 UTC
+++ /src/robot/utils/error.py Tue Sep 17 12:08:39 2013 UTC
@@ -98,7 +98,8 @@
name = name.split('.')[-1] # Use only last part of the name
if not message:
return name
- if name in self._generic_exceptions:
+ if name in self._generic_exceptions or \
+ getattr(self.error, 'ROBOT_SUPPRESS_NAME', False):
return message
return '%s: %s' % (name, message)
==============================================================================
Revision: f4cc9bba2e94
Branch: default
Author: Jussi Malinen <jussi.ao.mali...@gmail.com>
Date: Tue Sep 17 12:11:40 2013 UTC
Log: fix telnet tests and trace messages
http://code.google.com/p/robotframework/source/detail?r=f4cc9bba2e94
Modified:
/atest/robot/standard_libraries/telnet/read_and_write.txt
/atest/testdata/standard_libraries/telnet/configuration.txt
/atest/testdata/standard_libraries/telnet/read_and_write.txt
/src/robot/libraries/Telnet.py
=======================================
--- /atest/robot/standard_libraries/telnet/read_and_write.txt Thu Jan 31
21:22:54 2013 UTC
+++ /atest/robot/standard_libraries/telnet/read_and_write.txt Tue Sep 17
12:11:40 2013 UTC
@@ -74,9 +74,9 @@
Write Until Expected Output
${tc} = Check Test Case ${TEST NAME}
- Check Log Message ${tc.kws[1].msgs[0]} ${FULL PROMPT}a=$(($a -
1)); if (($a == 0)); then echo BLAST OFF; fi
+ Check Log Message ${tc.kws[1].msgs[0]} ${FULL PROMPT}a=$(($a -
1)); if (($a == 0)); then echo BLAST; fi
Check Log Message ${tc.kws[1].msgs[1]} ${FULL PROMPT}
- Check Log Message ${tc.kws[1].msgs[2]} a=$(($a - 1)); if (($a ==
0)); then echo BLAST OFF; fi
+ Check Log Message ${tc.kws[1].msgs[2]} a=$(($a - 1)); if (($a ==
0)); then echo BLAST; fi
Execute Command
Check Test Case ${TEST NAME}
=======================================
--- /atest/testdata/standard_libraries/telnet/configuration.txt Tue Feb 5
12:26:18 2013 UTC
+++ /atest/testdata/standard_libraries/telnet/configuration.txt Tue Sep 17
12:11:40 2013 UTC
@@ -33,7 +33,7 @@
Timeout Should Be 1 minute 1 second
Set Timeout Keyword
- [Documentation] FAIL No match found for 'Not found' in 42
milliseconds
+ [Documentation] FAIL STARTS: No match found for 'Not found' in 42
milliseconds.\nOutput:
Set Timeout 1 h 2 min 3 secs
Timeout Should Be 1 hour 2 minutes 3 seconds
Set Timeout 0.042
=======================================
--- /atest/testdata/standard_libraries/telnet/read_and_write.txt Thu Jan 31
21:22:54 2013 UTC
+++ /atest/testdata/standard_libraries/telnet/read_and_write.txt Tue Sep 17
12:11:40 2013 UTC
@@ -70,7 +70,7 @@
Should Be Equal ${out} Hyvää yötä
Read Until Fails
- [Documentation] FAIL No match found for 'Not found' in ${TIMEOUT}
+ [Documentation] FAIL No match found for 'Not found' in ${TIMEOUT}.
Read Until Not found
Read Until Regexp
@@ -95,7 +95,7 @@
Should Be Equal ${out} Päivää
Read Until Regexp Fails
- [Documentation] FAIL No match found for 'Not found' in ${TIMEOUT}
+ [Documentation] FAIL No match found for 'Not found' in ${TIMEOUT}.
Read Until Regexp Not found
Read Until Regexp Requires At Least One Pattern
@@ -103,7 +103,7 @@
Read Until Regexp
Read Until Prompt
- [Documentation] FAIL Prompt '$$' not found in ${TIMEOUT}
+ [Documentation] FAIL Prompt '$$' not found in ${TIMEOUT}.
Write pwd
${out} = Read Until Prompt
Should Be Equal ${out} ${HOME}\r\n${FULL PROMPT}
@@ -115,7 +115,7 @@
Read Until Prompt
Read Until Regexp Prompt
- [Documentation] FAIL Prompt 'No match' not found in ${TIMEOUT}
+ [Documentation] FAIL Prompt 'No match' not found in ${TIMEOUT}.
Set Prompt \\$\\s REGEXP
Write pwd
${out} = Read Until Prompt
@@ -125,9 +125,9 @@
Read Until Prompt
Write Until Expected Output
- [Documentation] FAIL No match found for 'Not found' in 300
milliseconds
+ [Documentation] FAIL No match found for 'Not found' in 300
milliseconds.
Write a=10
- Write Until Expected Output a=$(($a - 1)); if (($a == 0)); then
echo BLAST OFF; fi\r\n BLAST OFF 2 s 10ms
+ Write Until Expected Output a=$(($a - 1)); if (($a == 0)); then
echo BLAST; fi\r\n BLAST 2 s 10ms
Write Until Expected Output ls Not found 300ms 100ms
Execute Command
=======================================
--- /src/robot/libraries/Telnet.py Tue Sep 17 08:41:56 2013 UTC
+++ /src/robot/libraries/Telnet.py Tue Sep 17 12:11:40 2013 UTC
@@ -733,12 +733,12 @@
See `Logging` section for more information about log levels.
"""
if not self._prompt_is_set():
- raise RuntimeError('Prompt is not set')
+ raise RuntimeError('Prompt is not set.')
success, output = self._read_until_prompt()
self._log(output, loglevel)
if not success:
prompt, regexp = self._prompt
- raise AssertionError("Prompt '%s' not found in %s"
+ raise AssertionError("Prompt '%s' not found in %s."
% (prompt if not regexp else prompt.pattern,
utils.secs_to_timestr(self._timeout)))
return output
@@ -800,10 +800,11 @@
def msg(self, msg, *args):
# Forward telnetlib's debug messages to log
- logger.trace(lambda: msg % args)
+ logger.trace(msg % args)
class NoMatchError(AssertionError):
+ ROBOT_SUPPRESS_NAME = True
def __init__(self, expected, timeout, output=None):
self.expected = expected
@@ -813,8 +814,9 @@
def _get_message(self):
expected = "'%s'" % self.expected if isinstance(self.expected,
basestring) \
- else utils.seq2str(self.expected, lastsep=' or ')
+ 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)
+ return msg
+
==============================================================================
Revision: c59cff0b796a
Branch: default
Author: Jussi Malinen <jussi.ao.mali...@gmail.com>
Date: Tue Sep 17 12:23:50 2013 UTC
Log: cleanup telnet error messages and tests
http://code.google.com/p/robotframework/source/detail?r=c59cff0b796a
Modified:
/atest/testdata/standard_libraries/telnet/configuration.txt
/atest/testdata/standard_libraries/telnet/read_and_write.txt
/src/robot/libraries/Telnet.py
=======================================
--- /atest/testdata/standard_libraries/telnet/configuration.txt Tue Sep 17
12:11:40 2013 UTC
+++ /atest/testdata/standard_libraries/telnet/configuration.txt Tue Sep 17
12:23:50 2013 UTC
@@ -33,7 +33,7 @@
Timeout Should Be 1 minute 1 second
Set Timeout Keyword
- [Documentation] FAIL STARTS: No match found for 'Not found' in 42
milliseconds.\nOutput:
+ [Documentation] FAIL STARTS: No match found for 'Not found' in 42
milliseconds. Output:\n
Set Timeout 1 h 2 min 3 secs
Timeout Should Be 1 hour 2 minutes 3 seconds
Set Timeout 0.042
=======================================
--- /atest/testdata/standard_libraries/telnet/read_and_write.txt Tue Sep 17
12:11:40 2013 UTC
+++ /atest/testdata/standard_libraries/telnet/read_and_write.txt Tue Sep 17
12:23:50 2013 UTC
@@ -70,7 +70,7 @@
Should Be Equal ${out} Hyvää yötä
Read Until Fails
- [Documentation] FAIL No match found for 'Not found' in ${TIMEOUT}.
+ [Documentation] FAIL No match found for 'Not found' in ${TIMEOUT}.
Output:\n
Read Until Not found
Read Until Regexp
@@ -95,7 +95,7 @@
Should Be Equal ${out} Päivää
Read Until Regexp Fails
- [Documentation] FAIL No match found for 'Not found' in ${TIMEOUT}.
+ [Documentation] FAIL No match found for 'Not found' in ${TIMEOUT}.
Output:\n
Read Until Regexp Not found
Read Until Regexp Requires At Least One Pattern
=======================================
--- /src/robot/libraries/Telnet.py Tue Sep 17 12:11:40 2013 UTC
+++ /src/robot/libraries/Telnet.py Tue Sep 17 12:23:50 2013 UTC
@@ -637,7 +637,7 @@
return self.read_until(expected, loglevel)
except AssertionError:
pass
- self._raise_no_match_found(expected, timeout=timeout)
+ raise NoMatchError(expected, timeout)
def read(self, loglevel=None):
"""Reads everything that is currently available in the output.
@@ -663,7 +663,7 @@
success, output = self._read_until(expected)
self._log(output, loglevel)
if not success:
- self._raise_no_match_found(expected, output=output)
+ raise NoMatchError(expected, self._timeout, output)
return output
def _read_until(self, expected):
@@ -707,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, output=output)
+ raise NoMatchError(expected, self._timeout, output)
return output
def _read_until_regexp(self, *expected):
@@ -784,10 +784,6 @@
if msg:
logger.write(msg, level or self._default_log_level)
- def _raise_no_match_found(self, expected, timeout=None, output=None):
- timeout = utils.secs_to_timestr(timeout or self._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.
if opt == telnetlib.ECHO and cmd in (telnetlib.WILL,
telnetlib.WONT):
@@ -808,7 +804,7 @@
def __init__(self, expected, timeout, output=None):
self.expected = expected
- self.timeout = timeout
+ self.timeout = utils.secs_to_timestr(timeout)
self.output = output
AssertionError.__init__(self, self._get_message())
@@ -816,7 +812,7 @@
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
+ if self.output is not None:
+ msg += ' Output:\n%s' % self.output
return msg
--
---
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.