[Wnd-commit] wnd/wnd/unittests gui-runtests.py,1.1.1.1,1.2 testhelpers.py,1.1,1.2
Status: Alpha
Brought to you by:
jurner
|
From: jürgen u. <cer...@us...> - 2005-07-23 19:36:41
|
Update of /cvsroot/wnd/wnd/wnd/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32749 Modified Files: gui-runtests.py testhelpers.py Log Message: bit of this and a bit of that Index: gui-runtests.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/unittests/gui-runtests.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** gui-runtests.py 29 Apr 2005 15:25:29 -0000 1.1.1.1 --- gui-runtests.py 23 Jul 2005 19:36:33 -0000 1.2 *************** *** 1,3 **** --- 1,29 ---- + """Runs unittests from a GUI. + + The gui will search all subfolders for modules starting with 'test_'. + All files matching this pattern will be listed (dynamically) in the + GUIs menu. + + Each module should define a suites function, returning the runable test suites + + Each modue shoulddefine a variable PARENT, to allow the GUI to + assign itsself to. Right before running the suite the GUI will assign + itsself to this variable to allow the tests to use the GUI as parent + window. + + Each test case may include the Helpers class from the testhelpers + module within its base classes. The helpers class includes + a message handler ('onMSG'), collecting all messages send in a + cache. The methods 'GetMsg' and 'PeekMsg' can be used to + find out if a certain message was send. 'ClearMsgCache' will clear + the cache. + + + + + + """ + import os, array, imp, unittest *************** *** 145,154 **** --- 171,184 ---- def RunUnitTest(self, name, path): self.LVClear() + mod= imp.load_source(name, path) if hasattr(mod, 'suite'): + self.write('testing: %s\n' % name[5:]) + mod.PARENT= self suite=unittest.TestSuite(mod.suite()) unittest.TextTestRunner(stream=self, verbosity=VERBOSITY).run(suite) + self.write('*' *64 + '\n' ) mod.PARENT= None *************** *** 163,166 **** --- 193,198 ---- name, ext= os.path.splitext(x) if ext.lower()=='.py': + self.write('testing: %s\n' % name[5:]) + path=os.path.join(root, x) mod= imp.load_source(name, path) *************** *** 170,173 **** --- 202,207 ---- unittest.TextTestRunner(stream=self, verbosity=VERBOSITY).run(suite) + + self.write('*' *64 + '\n' + '*' *64 + '\n') mod.PARENT= None Index: testhelpers.py =================================================================== RCS file: /cvsroot/wnd/wnd/wnd/unittests/testhelpers.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** testhelpers.py 15 May 2005 09:54:25 -0000 1.1 --- testhelpers.py 23 Jul 2005 19:36:33 -0000 1.2 *************** *** 20,24 **** # def GetMsg(self, msg): ! """Retrieves a message in the cache and returns it. Returns the message if found, False otherwise""" flag= False --- 20,24 ---- # def GetMsg(self, msg): ! """Retrieves a message from the cache and returns it. Returns the message if found, False otherwise""" flag= False *************** *** 34,38 **** def PeekMsg(self, msg): ! """peeks a message in the cache an dremoves it if found. Return True if the message was found, False otherwise""" flag= False --- 34,38 ---- def PeekMsg(self, msg): ! """peeks a message from the cache an removes it if found. Return True if the message was found, False otherwise""" flag= False *************** *** 97,100 **** --- 97,101 ---- def RemovePyc(path): + ## removes all 'pyc' files in dir and sub root, dirs, files = os.walk(path).next() for i in files: |