[Happydoc-checkins] CVS: HappyDoc test_happydoc.py,1.82,1.83
Brought to you by:
doughellmann,
krlosaqp
From: Doug H. <dou...@us...> - 2002-05-12 20:16:41
|
Update of /cvsroot/happydoc/HappyDoc In directory usw-pr-cvs1:/tmp/cvs-serv8380 Modified Files: test_happydoc.py Log Message: If webchecker is available, use it to check links in HTML output. Index: test_happydoc.py =================================================================== RCS file: /cvsroot/happydoc/HappyDoc/test_happydoc.py,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** test_happydoc.py 7 Feb 2002 16:22:06 -0000 1.82 --- test_happydoc.py 12 May 2002 20:16:38 -0000 1.83 *************** *** 71,74 **** --- 71,83 ---- from happydoclib.StreamFlushTest import verboseLevel as globalVerboseLevel + WEB_CHECKER_DIR='/home/dhellmann/Downloads/Python-2.2/Tools/webchecker/' + + if os.path.exists(WEB_CHECKER_DIR) and (os.name == 'posix'): + sys.path.append(WEB_CHECKER_DIR) + import webchecker + WEBCHECKER_AVAILABLE=1 + else: + WEBCHECKER_AVAILABLE=0 + # # Modules with tests *************** *** 93,96 **** --- 102,107 ---- class HappyDocTestBase(StreamFlushTest): + + WEB_CHECKER = os.path.join(WEB_CHECKER_DIR, 'webchecker.py') def setUp(self): *************** *** 98,102 **** return ! def runHappyDoc(self, modules=(), extraArgs=()): # # Fix up output directory variable --- 109,113 ---- return ! def runHappyDoc(self, modules=(), extraArgs=(), useWebChecker=WEBCHECKER_AVAILABLE): # # Fix up output directory variable *************** *** 154,157 **** --- 165,185 ---- if msg: exit_code = 1 + + # + # Run webchecker to verify the links that were written to the + # output. + # + if useWebChecker and WEBCHECKER_AVAILABLE: + + if self.verboseLevel.get(): + print + print 'WebChecker:' + print + c = webchecker.Checker() + c.setflags( checkext=0, verbose=2, nonames=1 ) + url = os.path.join(output_dir, 'index.html') + c.addroot( url ) + c.run() + c.report() # *************** *** 207,211 **** def testHTMLSimple(self): assert (not self.runHappyDoc( (os.path.join('TestCases', 'test.py'),), ! extraArgs=('-p', '-',) ) ), 'Basic single-file docset test failed.' --- 235,240 ---- def testHTMLSimple(self): assert (not self.runHappyDoc( (os.path.join('TestCases', 'test.py'),), ! extraArgs=('-p', '-',), ! useWebChecker=1 ) ), 'Basic single-file docset test failed.' *************** *** 214,218 **** def testSelfHTMLCompact(self): assert (not self.runHappyDoc( (os.path.join('TestCases', 'test.py'),), ! extraArgs=('formatter_compactHTML=yes',)) ), 'Full self documentation with compact output test failed.' return --- 243,248 ---- def testSelfHTMLCompact(self): assert (not self.runHappyDoc( (os.path.join('TestCases', 'test.py'),), ! extraArgs=('formatter_compactHTML=yes',), ! useWebChecker=1) ), 'Full self documentation with compact output test failed.' return *************** *** 220,224 **** def testHTMLSingleFile(self): assert (not self.runHappyDoc( (os.path.join('TestCases', 'test.py'),), ! extraArgs=('-p', '-', '-T', 'SingleFile') ) ), 'Basic single-file docset test failed.' --- 250,255 ---- def testHTMLSingleFile(self): assert (not self.runHappyDoc( (os.path.join('TestCases', 'test.py'),), ! extraArgs=('-p', '-', '-T', 'SingleFile'), ! useWebChecker=1 ) ), 'Basic single-file docset test failed.' *************** *** 229,233 **** extraArgs=('-p', '-', '-T', 'SingleFile', 'formatter_compactHTML=yes', ! ) ) ), 'Basic single-file docset test failed.' --- 260,265 ---- extraArgs=('-p', '-', '-T', 'SingleFile', 'formatter_compactHTML=yes', ! ), ! useWebChecker=1 ) ), 'Basic single-file docset test failed.' *************** *** 236,240 **** def testHTMLStdout(self): assert (not self.runHappyDoc( (os.path.join('TestCases', 'test.py'),), ! extraArgs=('-T', 'StdOut') ) ), 'HTML to standard-output docset test failed.' --- 268,273 ---- def testHTMLStdout(self): assert (not self.runHappyDoc( (os.path.join('TestCases', 'test.py'),), ! extraArgs=('-T', 'StdOut'), ! useWebChecker=1 ) ), 'HTML to standard-output docset test failed.' *************** *** 272,275 **** --- 305,309 ---- assert (not self.runHappyDoc( (os.path.join('TestCases', 'test_import_packages_basic'),), + useWebChecker=1 ) ), 'Import from packages test failed.' *************** *** 279,283 **** assert (not self.runHappyDoc( (os.path.join('TestCases', 'test_import_packages'),), ! extraArgs=('docset_usePackages=0',), ) ), 'Import from packages while ignoring package special handling test failed.' --- 313,318 ---- assert (not self.runHappyDoc( (os.path.join('TestCases', 'test_import_packages'),), ! extraArgs=('docset_usePackages=0',), ! useWebChecker=1 ) ), 'Import from packages while ignoring package special handling test failed.' *************** *** 289,293 **** extraArgs=('-p', '', ! 'formatter_filenamePrefix=TESTPREFIX_') ) ), 'Formatter output prefix test failed.' --- 324,329 ---- extraArgs=('-p', '', ! 'formatter_filenamePrefix=TESTPREFIX_'), ! useWebChecker=1 ) ), 'Formatter output prefix test failed.' *************** *** 300,303 **** --- 336,340 ---- def testSelfHTML(self): assert (not self.runHappyDoc( (os.path.join(os.pardir, 'HappyDoc'),), + useWebChecker=1 ) ), 'Full self documentation test failed.' *************** *** 321,324 **** --- 358,362 ---- ), 'Full self documentation in DocBookS format output test failed.' return + class OtherWorkingDirTest(HappyDocTestBase): |