|
From: <kk...@us...> - 2011-02-08 22:19:34
|
Revision: 117
http://python-control.svn.sourceforge.net/python-control/?rev=117&view=rev
Author: kkchen
Date: 2011-02-08 22:19:28 +0000 (Tue, 08 Feb 2011)
Log Message:
-----------
minor changes to test.py
bb...@ra...
Modified Paths:
--------------
branches/control-0.4a/src/test.py
Modified: branches/control-0.4a/src/test.py
===================================================================
--- branches/control-0.4a/src/test.py 2011-02-08 22:19:23 UTC (rev 116)
+++ branches/control-0.4a/src/test.py 2011-02-08 22:19:28 UTC (rev 117)
@@ -56,7 +56,7 @@
###############################################################################
-def tests():
+def tests(verbosity=2):
import unittest
try: #auto test discovery is only implemented in python 2.7+
start_dir='./' #change to a tests directory eventually.
@@ -74,19 +74,13 @@
t.run(tests)
print 'Completed tests in',mod
except:
- #If can't do auto discovery, for now it is hard-coded. This is not ideal for
- #when new tests are added or existing ones are reorganized/renamed.
-
- #remove all of the print commands once tests are debugged and converted to
- #unittests.
-
- print 'Tests may be incomplete'
- t=unittest.TextTestRunner()
-
+ #find the modules ourselves without unittest discovery
testModules = findTests()
+ print 'Tests may be incomplete, will attempt to run tests in modules:'
+ for m in testModules:
+ print m
- suite = unittest.TestSuite()
- suiteList=[]
+ suiteList=[] #list of unittest.TestSuite objects
for mod in testModules:
exec('import '+mod+' as currentModule')
#After tests have been debugged and made into unittests, remove
@@ -101,8 +95,8 @@
print 'The test module '+mod+' doesnt have '+\
'a proper suite() function that returns a unittest.TestSuite object'+\
' Please fix this!'
- alltests = unittest.TestSuite(suiteList)
- t.run(unittest.TestSuite(alltests))
+ t=unittest.TextTestRunner(verbosity=verbosity)
+ t.run(unittest.TestSuite(unittest.TestSuite(suiteList)))
###############################################################################
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|