Commit 13d47738 authored by Rafael Monnerat's avatar Rafael Monnerat

Do not raise if the url is not available

Return a safe html selenium test code (which always fails) to indicate a problem when download a test. This will prevent Zelenium get Stalled during the launch.
parent b15455a0
def UpdateImage(image): def UpdateImage(image):
image._update_image_info() image._update_image_info()
def urlread(url): def urlread(url, safe_return=0):
import urllib import urllib
return urllib.urlopen(url).read() try:
return urllib.urlopen(url).read()
except IOError, e:
if safe_return:
# Return an Selenium test code that will obviously fail. This
# prevent zelenium test run get Stalled.
return """<html><body><table><tr><td>assertTextPresent</td>
<td>An error occurred when dowload %s : %s </td>
<td></td><tr></body></html>""" % (url , e)
raise IOError(e)
def editZPT(zpt, text): def editZPT(zpt, text):
zpt.pt_edit(text, 'text/html') zpt.pt_edit(text, 'text/html')
......
...@@ -58,7 +58,7 @@ test_list = []\n ...@@ -58,7 +58,7 @@ test_list = []\n
count = 0\n count = 0\n
for url in url_list:\n for url in url_list:\n
count += 1\n count += 1\n
test_list.append((context.Zuite_urlRead(url), \'url%s\' % count),)\n test_list.append((context.Zuite_urlRead(url, safe_return=1), \'%s %s\' % (count, url)),)\n
\n \n
return context.Zuite_createAndLaunchSeleniumTest(test_list=test_list,\n return context.Zuite_createAndLaunchSeleniumTest(test_list=test_list,\n
zuite_id=zuite_id)\n zuite_id=zuite_id)\n
......
54 55
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment