[Checkins] SVN: zc.selenium/trunk/src/zc/selenium/pytest. - Added
XML quoting for the selenium arguments (with the exception on
Christian Theune
ct at gocept.com
Mon Aug 28 17:24:14 EDT 2006
Log message for revision 69819:
- Added XML quoting for the selenium arguments (with the exception on
automatically generated comments)
- Fixed <br> to <br/>
Changed:
U zc.selenium/trunk/src/zc/selenium/pytest.py
U zc.selenium/trunk/src/zc/selenium/pytest.txt
-=-
Modified: zc.selenium/trunk/src/zc/selenium/pytest.py
===================================================================
--- zc.selenium/trunk/src/zc/selenium/pytest.py 2006-08-28 21:21:39 UTC (rev 69818)
+++ zc.selenium/trunk/src/zc/selenium/pytest.py 2006-08-28 21:24:14 UTC (rev 69819)
@@ -19,6 +19,7 @@
import os.path
import sys
import urlparse
+from xml.sax.saxutils import escape
import zope.publisher.interfaces.browser
@@ -48,7 +49,7 @@
class Row:
- def __init__(self, output, name, cssClass=None):
+ def __init__(self, output, name, cssClass=''):
self.output = output
self.__name__ = name
self.cssClass = cssClass
@@ -59,16 +60,17 @@
frame = sys._getframe(1)
filename = frame.f_code.co_filename
base = os.path.basename(filename)
- Row(self.output, 'comment', 'lineinfo')(
- '%s:%s <span class="longpath">%s:%d</span>'
- % (base, frame.f_lineno, filename, frame.f_lineno))
+ comment_arg1 = ('%s:%s <span class="longpath">%s:%d</span>' %
+ (base, frame.f_lineno, filename, frame.f_lineno))
+ self.raw('comment', comment_arg1, '', cssClass='lineinfo')
+ self.raw(self.__name__, escape(arg1), escape(arg2), self.cssClass)
+ def raw(self, name, arg1, arg2, cssClass):
append = self.output.append
- if self.cssClass:
- append('<tr class="%s">\n<td>' % self.cssClass)
- else:
- append('<tr>\n<td>')
- append(self.__name__)
+
+ html_css_class = ("%s %s" % (name, cssClass)).strip()
+ append('<tr class="%s">\n<td>' % html_css_class)
+ append(name)
append('</td>\n')
append('<td>')
append(arg1)
@@ -148,7 +150,7 @@
mess = ''
if title:
mess += '\n<h1>%s</h1>\n' % title
- mess += '<br>\n'.join((self.__doc__ or '').split('\n')[1:])
+ mess += '<br/>\n'.join((self.__doc__ or '').split('\n')[1:])
self.selenium = Selenium(self.request, title, mess)
@@ -199,6 +201,6 @@
mess = ''
if title:
mess += '\n<h%d>%s</h%d>' % (level, title, level)
- mess += '<br>\n'.join(doc.split('\n')[1:])
+ mess += '<br/>\n'.join(doc.split('\n')[1:])
- self.selenium.comment(mess)
+ self.selenium.comment.raw('comment', mess, '', '')
Modified: zc.selenium/trunk/src/zc/selenium/pytest.txt
===================================================================
--- zc.selenium/trunk/src/zc/selenium/pytest.txt 2006-08-28 21:21:39 UTC (rev 69818)
+++ zc.selenium/trunk/src/zc/selenium/pytest.txt 2006-08-28 21:24:14 UTC (rev 69819)
@@ -7,7 +7,7 @@
The pytest module allows a much more concise format to be used. Test
go from source like this::
-
+
<tr>
<td>verifyLocation</td>
<td>/FIPS/home/fred/addIntelProductProcessFromHomePage.html</td>
@@ -92,79 +92,79 @@
<tr>
<td rowspan="1" colspan="3">
<h1>My first test</h1>
- <br>
- Anyone can write a test<br>
- in Python<br>
+ <br/>
+ Anyone can write a test<br/>
+ in Python<br/>
</td>
</tr>
<BLANKLINE>
- <tr>
+ <tr class="open">
<td>open</td>
<td>http://127.0.0.1/@@/selenium-push.html</td>
<td></td>
</tr>
- <tr>
+ <tr class="open">
<td>open</td>
<td>http://127.0.0.1/@@/selenium-push.html</td>
<td></td>
</tr>
- <tr>
+ <tr class="comment">
<td>comment</td>
<td>show something</td>
<td></td>
</tr>
- <tr class="lineinfo">
+ <tr class="comment lineinfo">
<td>comment</td>
<td><doctest pytest.txt[1]>:11 ...</td>
<td></td>
</tr>
- <tr>
+ <tr class="foo">
<td>foo</td>
<td>bar</td>
<td></td>
</tr>
- <tr class="lineinfo">
+ <tr class="comment lineinfo">
<td>comment</td>
<td><doctest pytest.txt[1]>:12 ...</td>
<td></td>
</tr>
- <tr>
+ <tr class="splat">
<td>splat</td>
<td>eeek</td>
<td>oy</td>
</tr>
- <tr>
+ <tr class="open">
<td>open</td>
<td>http://127.0.0.1/@@/selenium-pop.html</td>
<td></td>
</tr>
- <tr>
+ <tr class="comment">
<td>comment</td>
<td>
<h2>Show something</h2></td>
<td></td>
</tr>
- <tr>
+ <tr class="open">
<td>open</td>
<td>http://127.0.0.1/@@/selenium-push.html</td>
<td></td>
</tr>
- <tr class="lineinfo">
+ <tr class="comment lineinfo">
<td>comment</td>
<td><doctest pytest.txt[1]>:18 ...</td>
<td></td>
</tr>
- <tr>
+ <tr class="foo">
<td>foo</td>
<td>bar</td>
<td></td>
</tr>
- <tr>
+ <tr class="open">
<td>open</td>
<td>http://127.0.0.1/@@/selenium-pop.html</td>
<td></td>
</tr>
- <tr>
+ <tr class="open">
<td>open</td>
<td>http://127.0.0.1/@@/selenium-pop.html</td>
<td></td>
@@ -244,38 +244,38 @@
</td>
</tr>
<BLANKLINE>
- <tr>
+ <tr class="open">
<td>open</td>
<td>http://127.0.0.1/@@/selenium-push.html</td>
<td></td>
</tr>
- <tr>
+ <tr class="comment">
<td>comment</td>
<td>
<h2>Show frame selection</h2></td>
<td></td>
</tr>
- <tr>
+ <tr class="open">
<td>open</td>
<td>http://127.0.0.1/@@/selenium-push.html</td>
<td></td>
</tr>
- <tr class="lineinfo">
+ <tr class="comment lineinfo">
<td>comment</td>
<td><doctest pytest.txt[5]>:6 ...</td>
<td></td>
</tr>
- <tr>
+ <tr class="sample">
<td>sample</td>
<td></td>
<td></td>
</tr>
- <tr>
+ <tr class="open">
<td>open</td>
<td>http://127.0.0.1/@@/selenium-pop.html</td>
<td></td>
</tr>
- <tr>
+ <tr class="open">
<td>open</td>
<td>http://127.0.0.1/@@/selenium-pop.html</td>
<td></td>
@@ -300,7 +300,7 @@
...
... def sharedSetUp(self):
... """Basic set up
- ...
+ ...
... Because we can.
... """
... super(Second, self).sharedSetUp()
@@ -317,14 +317,14 @@
... """Doc strings for setUp and tearDown become comments
... """
... self.selenium.comment('No pop needed')
- ...
+ ...
... def testx(self):
... s = self.selenium
... s.open(s.server)
...
... def testy(self):
... """Show something
- ... """
+ ... """
... s = self.selenium
... s.foo('bar')
... s.baz(lineno=False)
@@ -346,102 +346,102 @@
</td>
</tr>
<BLANKLINE>
- <tr>
+ <tr class="comment">
<td>comment</td>
<td>
- <h2>Basic set up</h2> <br>
+ <h2>Basic set up</h2><br/>
Because we can.</td>
<td></td>
</tr>
- <tr>
+ <tr class="open">
<td>open</td>
<td>http://127.0.0.1/@@/selenium-push.html</td>
<td></td>
</tr>
- <tr class="lineinfo">
+ <tr class="comment lineinfo">
<td>comment</td>
<td><doctest pytest.txt[8]>:11 ...</td>
<td></td>
</tr>
- <tr>
+ <tr class="foo">
<td>foo</td>
<td>start</td>
<td></td>
</tr>
- <tr>
+ <tr class="comment">
<td>comment</td>
<td>No push needed</td>
<td></td>
</tr>
- <tr class="lineinfo">
+ <tr class="comment lineinfo">
<td>comment</td>
<td><doctest pytest.txt[8]>:27 ...</td>
<td></td>
</tr>
- <tr>
+ <tr class="open">
<td>open</td>
<td>127.0.0.1</td>
<td></td>
</tr>
- <tr>
+ <tr class="comment">
<td>comment</td>
<td>
<h3>Doc strings for setUp and tearDown become comments</h3></td>
<td></td>
</tr>
- <tr>
+ <tr class="comment">
<td>comment</td>
<td>No pop needed</td>
<td></td>
</tr>
- <tr>
+ <tr class="comment">
<td>comment</td>
<td>
<h2>Show something</h2></td>
<td></td>
</tr>
- <tr>
+ <tr class="comment">
<td>comment</td>
<td>No push needed</td>
<td></td>
</tr>
- <tr class="lineinfo">
+ <tr class="comment lineinfo">
<td>comment</td>
<td><doctest pytest.txt[8]>:33 ...</td>
<td></td>
</tr>
- <tr>
+ <tr class="foo">
<td>foo</td>
<td>bar</td>
<td></td>
</tr>
- <tr>
+ <tr class="baz">
<td>baz</td>
<td></td>
<td></td>
</tr>
- <tr>
+ <tr class="comment">
<td>comment</td>
<td>
<h3>Doc strings for setUp and tearDown become comments</h3></td>
<td></td>
</tr>
- <tr>
+ <tr class="comment">
<td>comment</td>
<td>No pop needed</td>
<td></td>
</tr>
- <tr>
+ <tr class="open">
<td>open</td>
<td>http://127.0.0.1/@@/selenium-pop.html</td>
<td></td>
</tr>
- <tr class="lineinfo">
+ <tr class="comment lineinfo">
<td>comment</td>
<td><doctest pytest.txt[8]>:15 ...</td>
<td></td>
</tr>
- <tr>
+ <tr class="foo">
<td>foo</td>
<td>end</td>
<td></td>
More information about the Checkins
mailing list