prevline = line
+ prefix_exception = frozenset(["/", "/version", "/2"])
+
undocumented = []
for key, handler in resources.iteritems():
# Regex objects
if hasattr(key, "match"):
+ self.assert_(key.pattern.startswith("^/2/"),
+ msg="Pattern %r does not start with '^/2/'" % key.pattern)
+
found = False
for title in titles:
if (title.startswith("``") and
if not found:
# TODO: Find better way of identifying resource
- undocumented.append(str(handler))
+ undocumented.append(key.pattern)
+
+ else:
+ self.assert_(key.startswith("/2/") or key in prefix_exception,
+ msg="Path %r does not start with '/2/'" % key)
- elif ("``%s``" % key) not in titles:
- undocumented.append(key)
+ if ("``%s``" % key) not in titles:
+ undocumented.append(key)
self.failIf(undocumented,
msg=("Missing RAPI resource documentation for %s" %
- " ,".join(undocumented)))
+ utils.CommaJoin(undocumented)))
class TestManpages(unittest.TestCase):
@staticmethod
def _ReadManFile(name):
- return utils.ReadFile("%s/man/%s.sgml" %
+ return utils.ReadFile("%s/man/%s.rst" %
(testutils.GetSourceDir(), name))
@staticmethod
missing = []
for cmd in commands:
- pattern = "<cmdsynopsis>\s*<command>%s</command>" % re.escape(cmd)
- if not re.findall(pattern, mantext, re.S):
+ pattern = r"^(\| )?\*\*%s\*\*" % re.escape(cmd)
+ if not re.findall(pattern, mantext, re.DOTALL | re.MULTILINE):
missing.append(cmd)
self.failIf(missing,
msg=("Manpage for '%s' missing documentation for %s" %
- (script, " ,".join(missing))))
+ (script, utils.CommaJoin(missing))))
if __name__ == "__main__":
- unittest.main()
+ testutils.GanetiTestProgram()