The ovsdb-doc utility uses the ovs Python library. This patch runs it in the virtual Python environments (2.7 and 3.4) to ensure that it completes successfully. This helped quickly expose some more bugs in the Python 3 port.
The patch includes the addition of the -s/--silent option to ovsdb-doc, as we don't want the nroff output sent to stdout in this case. Signed-off-by: Russell Bryant <russ...@ovn.org> --- ovsdb/ovsdb-doc | 19 ++++++++++++------- python/tox.ini | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ovsdb/ovsdb-doc b/ovsdb/ovsdb-doc index ee5fcb3..9ee48d9 100755 --- a/ovsdb/ovsdb-doc +++ b/ovsdb/ovsdb-doc @@ -275,22 +275,24 @@ where SCHEMA is an OVSDB schema in JSON format The following options are also available: --er-diagram=DIAGRAM.PIC include E-R diagram from DIAGRAM.PIC --version=VERSION use VERSION to display on document footer - -h, --help display this help message\ + -h, --help display this help message + -s, --silent Suppress output, used for validation """ % {'argv0': argv0}) sys.exit(0) if __name__ == "__main__": try: try: - options, args = getopt.gnu_getopt(sys.argv[1:], 'hV', + options, args = getopt.gnu_getopt(sys.argv[1:], 'hsV', ['er-diagram=', - 'version=', 'help']) + 'version=', 'help', 'silent']) except getopt.GetoptError as geo: sys.stderr.write("%s: %s\n" % (argv0, geo.msg)) sys.exit(1) er_diagram = None version = None + silent = False for key, value in options: if key == '--er-diagram': er_diagram = value @@ -298,6 +300,8 @@ if __name__ == "__main__": version = value elif key in ['-h', '--help']: usage() + elif key in ['-s', '--silent']: + silent = True else: sys.exit(0) @@ -308,10 +312,11 @@ if __name__ == "__main__": # XXX we should warn about undocumented tables or columns s = docsToNroff(args[0], args[1], er_diagram, version) - for line in s.split("\n"): - line = line.strip() - if len(line): - print(line) + if not silent: + for line in s.split("\n"): + line = line.strip() + if len(line): + print(line) except error.Error as e: sys.stderr.write("%s: %s\n" % (argv0, e.msg)) diff --git a/python/tox.ini b/python/tox.ini index 392870c..d5422f8 100644 --- a/python/tox.ini +++ b/python/tox.ini @@ -9,6 +9,7 @@ envlist = py27,py34,pep8 [testenv] usedevelop = True commands = {envbindir}/nosetests ovs/tests + {envbindir}/python {toxinidir}/../ovsdb/ovsdb-doc -s {toxinidir}/../vswitchd/vswitch.ovsschema {toxinidir}/../vswitchd/vswitch.xml deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -- 2.5.0 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev