Fwd: Testoob: How do you use testoob.collector_from_globals / collector_from_modules?

23 views
Skip to first unread message

orip

unread,
Jul 28, 2009, 3:21:42 AM7/28/09
to Testoob
Forwarding


---------- Forwarded message ----------
From: Harry Ebbers <neme...@gmail.com>
Date: Jul 27, 4:12 pm
Subject: Testoob: How do you use testoob.collector_from_globals /
collector_from_modules?
To: comp.lang.python


Hi,

For a project I'm creating unittests using testoob. When all tests are
in a single file there is no problem

if __name__ == '__main__':
    testoob.main()
 does the trick as usual.

But for a number of python-applications they have asked me to group
unittests in different files, based on common functionality (e.g. GUI,
main-application, etcetera).

Ican get it to work by importing all unittestclasses in the following
way and than use the normal if __name__ == '__main__' construction

(from GUI import GUItests
from APP import APPtests

if __name__ == '__main__':
    testoob.main())

But looking at the future I would like to use testsuites.

On the internet I found the functions testoob.collector_from_globals
and collector_from_modules which one can use to 'easily' create
testsuites which can be used with testoob. But no examples on how to
use them can be found.

Can anybody supply me with a working example?

TIA

Harry Ebbers

orip

unread,
Aug 1, 2009, 3:44:59 AM8/1/09
to Testoob
Try looking at Testoob's own test suites - we use collect_from_files
instead, but that could help.
For example:
http://bazaar.launchpad.net/~testoob-team/testoob/trunk/annotate/head:/tests/large/__init__.py

Harry Ebbers

unread,
Aug 3, 2009, 9:23:47 AM8/3/09
to Testoob
The collect_from_files construction looks simpeler, but I'm probably
doing something wrong since I get the following error with the first
file I tried to see if this works for me:

ERROR: Can't find test case 'XPRMSE_TC_unittest'

XPRMSE_TC_unittest is not a test-case but a file containing test-cases
which I import in the main unittest file as follows:

def suite ():
return testoob.collecting.collect_from_files
( "XPRMSE_TC_unittest.py" )

if __name__ == '__main__':
viad_configure()
testoob.main( defaultTest = "suite" )


What am I doing wrong?
XPRMSE_TC_unittest.py contains multiple testclasses each containing
functions with 'test_' as should be expected, thus I hoped that the
command would collect them from the file.

Kind regards,

Harry


On Aug 1, 9:44 am, orip <ori...@gmail.com> wrote:
> Try looking at Testoob's own test suites - we use collect_from_files
> instead, but that could help.
> For example:http://bazaar.launchpad.net/~testoob-team/testoob/trunk/annotate/head...
Reply all
Reply to author
Forward
0 new messages