[Happydoc-checkins] CVS: HappyDoc test_happydoc.py,1.84,1.85
Brought to you by:
doughellmann,
krlosaqp
|
From: Doug H. <dou...@us...> - 2002-06-08 16:59:28
|
Update of /cvsroot/happydoc/HappyDoc
In directory usw-pr-cvs1:/tmp/cvs-serv326
Modified Files:
test_happydoc.py
Log Message:
Structural changes to support GUI test runner.
Index: test_happydoc.py
===================================================================
RCS file: /cvsroot/happydoc/HappyDoc/test_happydoc.py,v
retrieving revision 1.84
retrieving revision 1.85
diff -C2 -d -r1.84 -r1.85
*** test_happydoc.py 13 May 2002 10:47:29 -0000 1.84
--- test_happydoc.py 8 Jun 2002 16:59:25 -0000 1.85
***************
*** 562,566 ****
--- 562,663 ----
])
+
+ def addAllTests(test_loader, actual_test_suite):
+ #
+ # Load tests from modules we know contain tests
+ #
+ for m in (
+ #
+ # Supporting tools
+ #
+ happydoclib.CommandLineApp,
+ happydoclib.indentstring,
+ happydoclib.optiontools,
+ happydoclib.trace,
+ happydoclib.path,
+
+ #
+ # Foundation modules
+ #
+ happydoclib.parsecomments,
+ happydoclib.parseinfo,
+ happydoclib.happydocstring,
+ happydoclib.happydocset,
+
+ #
+ # Docstring converters
+ #
+ happydoclib.docstring,
+ happydoclib.docstring.docstring_ClassicStructuredText,
+ happydoclib.docstring.docstring_StructuredText,
+ happydoclib.docstring.docstring_RawText,
+ happydoclib.docstring.docstring_PlainText,
+
+ #
+ # Formatters
+ #
+ happydoclib.formatter.fileformatterbase,
+ happydoclib.formatter.openoffice,
+ happydoclib.formatter.formatter_HTMLFile,
+
+ #
+ # Docsets
+ #
+ happydoclib.docset.docset_MultipleFile
+
+ ):
+ actual_test_suite.addTest(test_loader.loadTestsFromModule(m))
+ #
+ # Load tests from classes in this module
+ #
+ for c in ( ExecuteHappyDocTest,
+ ExternalTest,
+ ):
+ actual_test_suite.addTest(test_loader.loadTestsFromTestCase(c))
+ return
+
+
+
+ def getBugTests(actual_test_suite, output_dir):
+ bug_ids = map(lambda x:x[18:-3], glob(os.path.join('TestCases', 'test_bug*.py')))
+ bug_ids.sort()
+ for bug in bug_ids:
+ #test_definitions.append( (bug, HappyDocBugRegressionTest) )
+ actual_test_suite.addTest(
+ HappyDocBugRegressionTest( methodName=bug,
+ outputDir=output_dir,
+ )
+ )
+ return
+
+ def getTestSuite(get_all_tests=1, get_bug_tests=1, output_dir='/dev/null',
+ progress_callback=None, args=[]):
+ actual_test_suite = unittest.TestSuite()
+
+ test_loader = HappyDocTestLoader(output_dir,
+ progress_callback,
+ (ExecuteHappyDocTest,
+ ZopeTest,
+ HappyDocBugRegressionTest,
+ ))
+
+ if get_all_tests:
+ addAllTests(test_loader, actual_test_suite)
+ getBugTests(actual_test_suite, output_dir)
+
+ elif get_bug_tests:
+ getBugTests(actual_test_suite, output_dir)
+ elif args:
+ # Run the tests specified by the user
+ for a in args:
+ actual_test_suite.addTest( test_loader.loadTestsFromName(a) )
+ else:
+ # Default to running all tests
+ get_all_tests = 0
+ actual_test_suite.addTest( test_loader.loadTestsFromName('__main__.ExecuteHappyDocTest.testSelfHTML') )
+
+ return actual_test_suite
+
class TestCaseDriver(happydoclib.CommandLineApp.CommandLineApp):
***************
*** 684,696 ****
# Figure out what tests to process
#
- actual_test_suite = unittest.TestSuite()
-
- test_loader = HappyDocTestLoader(self._output_dir,
- self.statusMessage,
- (ExecuteHappyDocTest,
- ZopeTest,
- HappyDocBugRegressionTest,
- ))
-
get_all_tests = 0
get_bug_tests = 0
--- 781,784 ----
***************
*** 700,784 ****
elif 'bugs' in args:
get_bug_tests = 1
! elif args:
! # Run the tests specified by the user
! for a in args:
! actual_test_suite.addTest( test_loader.loadTestsFromName(a) )
! else:
! # Default to running all tests
! get_all_tests = 0
! actual_test_suite.addTest( test_loader.loadTestsFromName('__main__.ExecuteHappyDocTest.testSelfHTML') )
!
! if get_all_tests:
! #
! # Load tests from modules we know contain tests
! #
! for m in (
! #
! # Supporting tools
! #
! happydoclib.CommandLineApp,
! happydoclib.indentstring,
! happydoclib.optiontools,
! happydoclib.trace,
! happydoclib.path,
!
! #
! # Foundation modules
! #
! happydoclib.parsecomments,
! happydoclib.parseinfo,
! happydoclib.happydocstring,
! happydoclib.happydocset,
!
! #
! # Docstring converters
! #
! happydoclib.docstring,
! happydoclib.docstring.docstring_ClassicStructuredText,
! happydoclib.docstring.docstring_StructuredText,
! happydoclib.docstring.docstring_RawText,
! happydoclib.docstring.docstring_PlainText,
!
! #
! # Formatters
! #
! happydoclib.formatter.fileformatterbase,
! happydoclib.formatter.openoffice,
! happydoclib.formatter.formatter_HTMLFile,
!
! #
! # Docsets
! #
! happydoclib.docset.docset_MultipleFile
!
! ):
! actual_test_suite.addTest(test_loader.loadTestsFromModule(m))
! #
! # Load tests from classes in this module
! #
! for c in ( ExecuteHappyDocTest,
! ExternalTest,
! ):
! actual_test_suite.addTest(test_loader.loadTestsFromTestCase(c))
!
!
#
! # Check tests related to bug reports
#
! if get_all_tests or get_bug_tests:
! bug_ids = map(lambda x:x[18:-3], glob(os.path.join('TestCases', 'test_bug*.py')))
! bug_ids.sort()
! for bug in bug_ids:
! #test_definitions.append( (bug, HappyDocBugRegressionTest) )
! actual_test_suite.addTest(
! HappyDocBugRegressionTest( methodName=bug,
! outputDir=self._output_dir,
! )
! )
! #
! # Optionally include the Zope tests
! #
! if self._include_zope:
! actual_test_suite.addTest(test_loader.loadTestsFromTestCase(ZopeTest))
#
--- 788,803 ----
elif 'bugs' in args:
get_bug_tests = 1
!
! actual_test_suite = getTestSuite(get_all_tests=get_all_tests,
! get_bug_tests=get_bug_tests,
! output_dir=self._output_dir,
! progress_callback=self.statusMessage,
! args=args)
!
#
! # Optionally include the Zope tests
#
! if self._include_zope:
! actual_test_suite.addTest(test_loader.loadTestsFromTestCase(ZopeTest))
#
|