Re: How to couple pyunit with GUI?

2006-05-18 Thread Miki
Hello volcano,

http://pyunit.sourceforge.net/ has unittestgui.py (bit old though)

HTH,
Miki
http://pythonwise.blogspot.com/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to couple pyunit with GUI?

2006-05-18 Thread volcano
Miki, toda, but it did not work for me. BTW, I have forgotten to
mention - the implementation I develop should be multi-platform.If
anything else comes to you mind - I'll be more than gateful to hear.
Regards,
Mark

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to couple pyunit with GUI?

2006-05-18 Thread Fabio Zadrozny
Hi Mark,On 5/18/06, Mark Geyzer [EMAIL PROTECTED] wrote:
Fabio, thank you for your response, but I'm afraid that you
misunderstood me - probably, I was not too clear. I do no test GUI - on
the contrary, I am testing a HW interface. What I do need is a GUI
equivalent of the TextTestRunner method. Any ideas?

My fault, I did just a 'fast-read'.

Well, I use pydev (http://pydev.sf.net), which allows me to select a
folder and then recursively run all the unit-tests below that folder.
Pydev is the gui, but the underlying module that actually runs the
tests does not actually need a gui (I'm sending it attached). Just send
it the dir you want and it will recursively inspect the modules, get
the unit-tests and run them.

You can probably easily extend it to run the files you want and not get
things recursively if you don't want it... But with all that, It is
still a command-line utility -- if you stilll want a gui to it, try
pydev, which will allow you to right-click a folder and run all the
unit-tests below it.

Cheers,

Fabio
On 5/17/06, 
Fabio Zadrozny [EMAIL PROTECTED] wrote:

On 17 May 2006 08:24:40 -0700, volcano 

[EMAIL PROTECTED] wrote:
I am desperately looking for an info how to combine a testingapplication with decent GUI interface - the way most xUnits do. Ibelieve I have seen something about using Tkinter, but I do notremember - where.


I am working on a complex testing application built over unittestmodule, and I need GUI interface that will alllow me to select tests atdifferent levels of test hierarchy tree.I am new to python, so say everything slow and repeat it twice:)
--http://mail.python.org/mailman/listinfo/python-list


Have you checked http://pyguiunit.sourceforge.net/ -- it is for PyQt, but can probably be adapted for other GUIs.


-- Fabio

-- Mark GeyzerSoftware Engineer,tel: +972-52-6782603


'''
Usage:

runfiles.py dir [dir...]

Run all unit tests found in the current path. An unit test is a file with 
TestCase-derived classes. 
'''

import sys
import unittest
import optparse
import fnmatch
import os
import os.path
import re


def MatchMasks( p_FileName, p_Filters ):
for filter in p_Filters:
if fnmatch.fnmatch( p_FileName, filter ):
return 1
return 0


def NotDir( p_FileName ):
return not os.path.isdir( p_FileName )


def _FindFiles( p_Path, p_InFilters, p_OutFilters, p_Recursive = True ):
import os
import fnmatch

if not p_Path: p_Path = '.'

def AddFile( o_Result, p_DirName, p_FileNames ):
p_FileNames = filter( lambda x: MatchMasks( x, p_InFilters ), p_FileNames ) 
p_FileNames = filter( lambda x: not MatchMasks( x, p_OutFilters ), p_FileNames ) 
p_FileNames = filter( NotDir, p_FileNames ) 
p_FileNames = [os.path.join( p_DirName, x ) for x in p_FileNames]
o_Result.extend( p_FileNames )

result = []
if (p_Recursive):
os.path.walk( p_Path, AddFile, result )
else:
result = os.listdir( p_Path )
result = filter( lambda x: MatchMasks( x, p_InFilters ), result ) 
result = filter( lambda x: not MatchMasks( x, p_OutFilters ), result ) 
result = filter( NotDir, result )
result = [os.path.join( p_Path, x ) for x in result]
return result;


def make_list( p_element ):
'''
Returns p_element as a list.
'''
if isinstance( p_element, list ):
return p_element
else:
return [p_element,]


def FindFiles( p_Pathes, p_InFilters=None, p_OutFilters=None, p_Recursive = True ):
'''
Find files recursivelly, in one or more directories, matching the
given IN and OUT filters.

@param p_Patches: One or a list of patches to search.

@param p_InFilters: A list of filters (DIR format) to match. Defaults
to ['*.*'].

@param p_OutFilters
A list of filters (DIR format) to ignore. Defaults to [].

@param p_Recursive
Recursive search? 
'''
if p_InFilters is None:
p_InFilters = ['*.*']
if p_OutFilters is None:
p_OutFilters = []
p_Pathes = make_list( p_Pathes )
result = []
for i_path in p_Pathes:
files = _FindFiles( i_path, p_InFilters, p_OutFilters, p_Recursive )
result.extend( files )
return result






def parse_cmdline():
usage='usage: %prog directory [other_directory ...]'  
parser = optparse.OptionParser(usage=usage)

options, args = parser.parse_args()
if not args:
parser.print_help()
sys.exit(1)
return args


#=
#IMPORTING 
#=
def FormatAsModuleName( filename):
result = filename
result = result.replace( '\\', '/' )
result = result.split( '/' )
result = '.'.join( result )
return result

def SystemPath( 

How to couple pyunit with GUI?

2006-05-17 Thread volcano
I am desperately looking for an info how to combine a testing
application with decent GUI interface - the way most xUnits do. I
believe I have seen something about using Tkinter, but I do not
remember - where.
I am working on a complex testing application built over unittest
module, and I need GUI interface that will alllow me to select tests at
different levels of test hierarchy tree.
I am new to python, so say everything slow and repeat it twice:)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to couple pyunit with GUI?

2006-05-17 Thread Fabio Zadrozny
On 17 May 2006 08:24:40 -0700, volcano [EMAIL PROTECTED] wrote:
I am desperately looking for an info how to combine a testingapplication with decent GUI interface - the way most xUnits do. Ibelieve I have seen something about using Tkinter, but I do notremember - where.
I am working on a complex testing application built over unittestmodule, and I need GUI interface that will alllow me to select tests atdifferent levels of test hierarchy tree.I am new to python, so say everything slow and repeat it twice:)
--http://mail.python.org/mailman/listinfo/python-list
Have you checked http://pyguiunit.sourceforge.net/ -- it is for PyQt, but can probably be adapted for other GUIs.

-- Fabio
-- 
http://mail.python.org/mailman/listinfo/python-list