From: Kevin A. <ka...@us...> - 2004-05-25 19:47:20
|
Update of /cvsroot/pythoncard/PythonCard/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10623/tests Modified Files: runAllTests.py Added Files: runTimeTest.py Log Message: renamed test.py to runTimeTest.py and moved it to tests updated runAllTests.py to use endswith instead of regular expression removed .rsrc.py from tests Index: runAllTests.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tests/runAllTests.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** runAllTests.py 22 May 2004 01:05:29 -0000 1.1 --- runAllTests.py 25 May 2004 19:47:08 -0000 1.2 *************** *** 11,19 **** the command line. It defaults to using pyunit.TextTestRunner. """ ! import pyunit, sys ! import os, os.path, re def loadTheSuite(modName): - import types try: mod = __import__(modName, globals(), locals(), []) --- 11,21 ---- the command line. It defaults to using pyunit.TextTestRunner. """ ! import os ! import sys ! import types ! import re ! import pyunit def loadTheSuite(modName): try: mod = __import__(modName, globals(), locals(), []) *************** *** 53,59 **** lambda fileName: loadTheSuite(os.path.splitext(fileName)[0]), filter( ! lambda x: re.match("[^.]*\.py$", x) ! and not re.match(ignoredFiles, x) ! and x!= 'setup.py', files))) os.chdir(walkPos) --- 55,62 ---- lambda fileName: loadTheSuite(os.path.splitext(fileName)[0]), filter( ! ## lambda x: re.match("[^.]*\.py$", x) ! lambda x: (not x.endswith('.rsrc.py') and x.endswith('.py') or x.endswith('.pyw')) ! and not re.match(ignoredFiles, x), ! ## and x!= 'setup.py', files))) os.chdir(walkPos) --- NEW FILE: runTimeTest.py --- """ __version__ = "$Revision: 1.1 $" __date__ = "$Date: 2004/05/25 19:47:08 $" """ import sys from PythonCard import model import threading import wx class Runtime( threading.Thread ) : def __init__( self, path, clazz ) : threading.Thread.__init__( self ) sys.argv = [ path ] self._clazz = clazz self._running = False self.start() def run( self ) : self._app = model.Application( self._clazz ) self._running = True self._app.MainLoop() def getApplication( self ) : while not self._running : pass return self._app class User( object ) : def __init__( self, window ) : """ Create a test proxy to a PythonCard window. """ self._window = window def click( self, path ) : """ Generate a mouse down event for the button identified by 'path'. Path example: myPanel.myButton """ button = self._window.getComponent( path ) event = wx.CommandEvent( wx.wxEVT_COMMAND_BUTTON_CLICKED, button.GetId() ) wx.PostEvent( button, event ) def type( self, path, text ) : """ Type the 'text', character by character, into the TextField or TextArea identified by 'path' Path example: myPanel.myField """ field = self._window.getComponent( path ) field.SetValue( text ) #event = wx.CommandEvent( wx.wxEVT_COMMAND_TEXT_ENTER, field.GetId() ) #wx.PostEvent( field, event ) def select( self, path, value ) : """ Set the selected value of the component identified by path to 'value'. This method can be used for popop menus, and single selection lists. Path example: myPanel.myMenu """ pass |