diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2012-09-28 09:52:41 -0700 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2012-10-19 09:10:14 +0200 |
commit | 8412b57f5ce40901a0a4e2e66c5f9bcbdcb4b46e (patch) | |
tree | 3ec31ce2e6adea2ad40bbfa5235ecdabb515c01a | |
parent | 2a31f0b50976dc5b6770639b60184a8ef9158b8b (diff) | |
download | samba-8412b57f5ce40901a0a4e2e66c5f9bcbdcb4b46e.tar.gz |
samba.tests.docs: Skip tests if xsltproc is not present.
-rw-r--r-- | source4/scripting/python/samba/tests/docs.py | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/source4/scripting/python/samba/tests/docs.py b/source4/scripting/python/samba/tests/docs.py index ec2ab37adc..def759b133 100644 --- a/source4/scripting/python/samba/tests/docs.py +++ b/source4/scripting/python/samba/tests/docs.py @@ -21,7 +21,9 @@ import samba import samba.tests +from samba.tests import TestSkipped +import errno import os import re import subprocess @@ -35,10 +37,21 @@ class TestCase(samba.tests.TestCase): return message + '\n\n %s' % ('\n '.join(parameters)) +class NoXsltProc(Exception): + + def __init__(self): + Exception.__init__(self, "'xsltproc' is not installed") + + def get_documented_parameters(sourcedir): - p = subprocess.Popen( - ["xsltproc", "--xinclude", "--param", "smb.context", "ALL", "generate-context.xsl", "parameters.all.xml"], - stdout=subprocess.PIPE, cwd=os.path.join(sourcedir, "docs-xml", "smbdotconf")) + try: + p = subprocess.Popen( + ["xsltproc", "--xinclude", "--param", "smb.context", "ALL", "generate-context.xsl", "parameters.all.xml"], + stdout=subprocess.PIPE, cwd=os.path.join(sourcedir, "docs-xml", "smbdotconf")) + except OSError, e: + if e.errno == errno.ENOENT: + raise NoXsltProc() + raise out, err = p.communicate() assert p.returncode == 0, "returncode was %r" % p.returncode for l in out.splitlines(): @@ -82,7 +95,10 @@ class SmbDotConfTests(TestCase): def test_unknown(self): topdir = samba.source_tree_topdir() - documented = set(get_documented_parameters(topdir)) + try: + documented = set(get_documented_parameters(topdir)) + except NoXsltProc: + raise TestSkipped("'xsltproc' is missing, unable to load parameters") parameters = set(get_implementation_parameters(topdir)) # Filter out parametric options, since we can't find them in the parm # table @@ -94,7 +110,10 @@ class SmbDotConfTests(TestCase): def test_undocumented(self): topdir = samba.source_tree_topdir() - documented = set(get_documented_parameters(topdir)) + try: + documented = set(get_documented_parameters(topdir)) + except NoXsltProc: + raise TestSkipped("'xsltproc' is missing, unable to load parameters") parameters = set(get_implementation_parameters(topdir)) undocumented = parameters.difference(documented) if len(undocumented) > 0: |