Back to index

plone3  3.1.7
Functions | Variables
kss.demo.selenium_utils.createpythontests Namespace Reference

Functions

def formatcommand

Variables

tuple template
tuple variable_regexp = re.compile('\$\{(?P<varname>\w*)\}')
tuple htmlparser = HTMLTreeBuilder.TreeBuilder()
list tests = []
tuple tree = HTMLTreeBuilder.parse(filename)
tuple root = tree.getroot()
tuple testname = root.find('.//title')
list commands = []
string testfilename = 'seltest_%s.py'
string testbody = ' def test_%s(self):\n'
tuple f = open('seltest_all.py', 'wb')

Function Documentation

Definition at line 32 of file createpythontests.py.

00032 
00033 def formatcommand(command, *args):
00034     if not command:
00035         return '' # Change this to raise an exception?
00036 
00037     arguments = []
00038     for arg in args:
00039         if not arg:
00040             continue
00041         matched = variable_regexp.match(arg)
00042         if matched is None:
00043             arguments.append('"%s"'%arg)
00044         else:
00045             arguments.append("self.getVar('%s')"%matched.group('varname'))
00046     return 'self.%s(%s)' % (command, ', '.join(arguments))


Variable Documentation

Definition at line 57 of file createpythontests.py.

tuple kss.demo.selenium_utils.createpythontests.f = open('seltest_all.py', 'wb')

Definition at line 65 of file createpythontests.py.

tuple kss.demo.selenium_utils.createpythontests.htmlparser = HTMLTreeBuilder.TreeBuilder()

Definition at line 47 of file createpythontests.py.

Definition at line 51 of file createpythontests.py.

Initial value:
00001 Template('''
00002 from seleniumtestcase import SeleniumTestCase
00003 import unittest, time
00004 
00005 class seltest_$testname(SeleniumTestCase):
00006 
00007 $tests
00008 
00009 def test_suite():
00010     return unittest.makeSuite(seltest_$testname)
00011 
00012 if __name__ == "__main__":
00013     unittest.main()
00014 ''')

Definition at line 15 of file createpythontests.py.

string kss.demo.selenium_utils.createpythontests.testbody = ' def test_%s(self):\n'

Definition at line 62 of file createpythontests.py.

Definition at line 61 of file createpythontests.py.

Definition at line 54 of file createpythontests.py.

Definition at line 48 of file createpythontests.py.

tuple kss.demo.selenium_utils.createpythontests.tree = HTMLTreeBuilder.parse(filename)

Definition at line 50 of file createpythontests.py.

tuple kss.demo.selenium_utils.createpythontests.variable_regexp = re.compile('\$\{(?P<varname>\w*)\}')

Definition at line 30 of file createpythontests.py.