[Proctor-checkins] CVS: Proctor/proctorlib cui.py,1.16,1.17 scanner.py,1.19,1.20
Status: Alpha
Brought to you by:
doughellmann
|
From: Doug H. <dou...@us...> - 2003-01-29 23:27:43
|
Update of /cvsroot/proctor/Proctor/proctorlib
In directory sc8-pr-cvs1:/tmp/cvs-serv11046/proctorlib
Modified Files:
cui.py scanner.py
Log Message:
Provide the ability to list the test categories.
Index: cui.py
===================================================================
RCS file: /cvsroot/proctor/Proctor/proctorlib/cui.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** cui.py 10 Jan 2003 16:51:29 -0000 1.16
--- cui.py 29 Jan 2003 23:27:40 -0000 1.17
***************
*** 77,80 ****
--- 77,81 ----
list_mode = 0
+ list_categories_mode = 0
run_mode = 1
parsable_mode = 0
***************
*** 90,93 ****
--- 91,100 ----
return
+ def optionHandler_list_categories(self):
+ """List test categories.
+ """
+ self.list_categories_mode = 1
+ return
+
def optionHandler_norun(self):
"""Do not run the tests
***************
*** 284,288 ****
if self.parsable_mode:
print '*** Start list'
! suite = moduleTree.getTestSuite(1)
for test in suite._tests:
self._showTestInfo(test, None)
--- 291,295 ----
if self.parsable_mode:
print '*** Start list'
! suite = moduleTree.getTestSuite(1, category=self.category)
for test in suite._tests:
self._showTestInfo(test, None)
***************
*** 292,295 ****
--- 299,309 ----
return success
+ def listCategories(self, moduleTree):
+ categories = moduleTree.getTestCategories()
+ categories.sort()
+ for category in categories:
+ print category
+ return
+
def getModuleTree(self, args):
***************
*** 322,325 ****
--- 336,343 ----
module_tree = self.getModuleTree(args)
success = self.listTests(module_tree)
+
+ elif self.list_categories_mode:
+ module_tree = self.getModuleTree(args)
+ success = self.listCategories(module_tree)
elif self.run_mode:
Index: scanner.py
===================================================================
RCS file: /cvsroot/proctor/Proctor/proctorlib/scanner.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** scanner.py 10 Jan 2003 16:52:22 -0000 1.19
--- scanner.py 29 Jan 2003 23:27:40 -0000 1.20
***************
*** 248,251 ****
--- 248,271 ----
return test_suite
+ def getTestCategories(self, categoryList=None):
+ if categoryList is None:
+ categoryList = []
+ #
+ # Categories at this level
+ #
+ my_categories = self.test_suites.keys()
+ for my_category in my_categories:
+ if my_category not in categoryList:
+ categoryList.append(my_category)
+
+ #
+ # Recurse
+ #
+ children = self.data.items()
+ for child_name, child_node in children:
+ child_node.getTestCategories(categoryList)
+
+ return categoryList
+
def getTestSuite(self, full=0, category='All'):
trace.into('ModuleTree', 'getTestSuite', outputLevel=self.TRACE_LEVEL)
|