[py-svn] r10768 - py/dist/py/documentation
hpk at codespeak.net
hpk at codespeak.net
Sun Apr 17 13:45:26 CEST 2005
Author: hpk
Date: Sun Apr 17 13:45:26 2005
New Revision: 10768
Modified:
py/dist/py/documentation/coding-style.txt
py/dist/py/documentation/rest_test.py
Log:
more extensive documentation checking use -R to check remote
links as well (by default only internal links are checked)
Modified: py/dist/py/documentation/coding-style.txt
==============================================================================
--- py/dist/py/documentation/coding-style.txt (original)
+++ py/dist/py/documentation/coding-style.txt Sun Apr 17 13:45:26 2005
@@ -68,7 +68,6 @@
`future_` book. Communication is considered a key here to make
sure that the py lib develops in a consistent way.
-.. _test-design: ../devel/testdesign.html
.. _`PEP 8 Style Guide for Python Code`: http://www.python.org/peps/pep-0008.html
.. _`py-dev mailing list`: http://codespeak.net/mailman/listinfo/py-dev
.. _`future`: future.html
Modified: py/dist/py/documentation/rest_test.py
==============================================================================
--- py/dist/py/documentation/rest_test.py (original)
+++ py/dist/py/documentation/rest_test.py Sun Apr 17 13:45:26 2005
@@ -2,24 +2,62 @@
import py
from py.__impl__.misc import rest
+from py.__impl__.documentation import conftest
docdir = py.path.svnwc(py.magic.autopath().dirpath())
-def restcheck(path):
+def checkdocutils():
try:
import docutils
except ImportError:
py.test.skip("docutils not importable")
- # this helper will raise errors instead of warnings
+
+def restcheck(path):
+ checkdocutils()
try:
+ # this helper will raise errors instead of warnings
rest.process(path)
except KeyboardInterrupt:
raise
except:
# we assume docutils printed info on stdout
py.test.fail("docutils processing failed, see captured stderr")
- #assert not out
def test_rest_files():
for x in docdir.listdir('*.txt'):
yield restcheck, x
+ yield linkcheck, x
+
+def linkcheck(path):
+ ddir = docdir.localpath
+
+ for lineno, line in py.builtin.enumerate(path.readlines()):
+ line = line.strip()
+ if line.startswith('.. _'):
+ l = line.split(':', 1)
+ if len(l) != 2:
+ continue
+ tryfn = l[1].strip()
+ if tryfn.startswith('http:'):
+ if not conftest.option.checkremote:
+ continue
+ try:
+ print "trying remote", tryfn
+ py.std.urllib2.urlopen(tryfn)
+ except py.std.urllib2.HTTPError:
+ py.test.fail("remote reference error %r in %s:%d" %(
+ tryfn, path.basename, lineno+1))
+ elif tryfn.endswith('.html'):
+ # assume it should be a file
+ fn = ddir.join(tryfn)
+ fn = fn.new(ext='.txt')
+ if not fn.check(file=1):
+ py.test.fail("reference error %r in %s:%d" %(
+ tryfn, path.basename, lineno+1))
+ else:
+ # yes, what else?
+ pass
+
+
+
+
More information about the pytest-commit
mailing list