Comment #2 on issue 1666 by [email protected]: Use Python pprint module inside Log keywords
http://code.google.com/p/robotframework/issues/detail?id=1666

I am testing REST APIs, and while they almost always return JSON that I can easily convert to a dictionary and then log, occasionally they just return integers, and then I get this sort of thing:

20140226 17:34:31.650 : DEBUG : "POST ***** HTTP/1.1" 200 None
20140226 17:34:31.650 : DEBUG : Post response: 1000395687
20140226 17:34:31.651 :  INFO : ${resp} = <Response [200]>
20140226 17:34:31.652 : DEBUG : Test timeout 2 minutes active. 110.896 seconds left. 20140226 17:34:31.652 : FAIL : TypeError: string indices must be integers, not str
20140226 17:34:31.652 : DEBUG :
Traceback (most recent call last):
File "/home/sdet/.virtualenvs/robot/local/lib/python2.7/site-packages/robot/libraries/Collections.py", line 659, in log_dictionary
    logger.write('\n'.join(self._log_dictionary(dictionary)), level)
File "/home/sdet/.virtualenvs/robot/local/lib/python2.7/site-packages/robot/libraries/Collections.py", line 669, in _log_dictionary
    yield '%s: %s' % (key, dictionary[key])


pprint is fairly smart about handling a variety of different kinds of data.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--

--- 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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to