[py-svn] r16238 - py/dist/py/documentation

hpk at codespeak.net hpk at codespeak.net
Mon Aug 22 22:15:49 CEST 2005


Author: hpk
Date: Mon Aug 22 22:15:48 2005
New Revision: 16238

Modified:
   py/dist/py/documentation/conftest.py
Log:
skip rest-processing by default for .txt where we have
a newer html file.  With "--forcegen" html-generation can
be forced though.



Modified: py/dist/py/documentation/conftest.py
==============================================================================
--- py/dist/py/documentation/conftest.py	(original)
+++ py/dist/py/documentation/conftest.py	Mon Aug 22 22:15:48 2005
@@ -7,6 +7,10 @@
         Option('-R', '--checkremote',
                action="store_true", dest="checkremote", default=False,
                help="check remote links in ReST files"
+        ),
+        Option('', '--forcegen',
+               action="store_true", dest="forcegen", default=False,
+               help="force generation of html files even if they appear up-to-date"
         )
 ) 
 
@@ -17,6 +21,7 @@
         py.test.skip("docutils not importable")
 
 def restcheck(path):
+    _checkskip(path.localpath)
     checkdocutils() 
     import docutils.utils
 
@@ -34,9 +39,18 @@
         # we assume docutils printed info on stdout 
         py.test.fail("docutils processing failed, see captured stderr") 
 
+def _checkskip(lpath):
+    if not option.forcegen:
+        if lpath.ext == '.txt': 
+            htmlpath = lpath.new(ext='.html')
+            if htmlpath.check(file=1) and htmlpath.mtime() >= lpath.mtime(): 
+                py.test.skip("html file is up to date, use --forcegen to regenerate")
+                #return [] # no need to rebuild 
+
 class ReSTSyntaxTest(py.test.Item): 
-    def run(self): 
+    def run(self):
         mypath = self.fspath 
+        _checkskip(mypath)
         restcheck(py.path.svnwc(mypath))
 
 class DoctestText(py.test.Item): 
@@ -165,10 +179,7 @@
 
 # ___________________________________________________________
 # 
-# hooking into py.test collector's chain ... 
-# because we generate subtests for all link checks 
-# it is a bit more convoluted than is strictly neccessary 
-# to perform the tests 
+# hooking into py.test Directory collector's chain ... 
 
 class DocDirectory(py.test.collect.Directory): 
     ReSTChecker = ReSTChecker 



More information about the pytest-commit mailing list