diff options
author | Alexander Sulfrian <alexander.sulfrian@fu-berlin.de> | 2016-08-18 01:48:17 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander.sulfrian@fu-berlin.de> | 2016-08-18 01:58:58 +0200 |
commit | dbfca9c48154047f54f8ce498981ae06b976d7cc (patch) | |
tree | 6dcf8bf4b5d266e36d64181d3c8c48f423882b40 | |
parent | 89312d7c5c0723427c3b95e863538a7c2a1885a5 (diff) | |
download | bcfg2-dbfca9c48154047f54f8ce498981ae06b976d7cc.tar.gz bcfg2-dbfca9c48154047f54f8ce498981ae06b976d7cc.tar.bz2 bcfg2-dbfca9c48154047f54f8ce498981ae06b976d7cc.zip |
doc: Add unit test to check for errors/warnings in doc
-rw-r--r-- | .travis.yml | 16 | ||||
-rw-r--r-- | testsuite/Testsrc/test_doc.py | 39 |
2 files changed, 49 insertions, 6 deletions
diff --git a/.travis.yml b/.travis.yml index d2be4783b..b868e83b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,14 @@ language: python -python: - - "2.6" - - "2.7_with_system_site_packages" -env: - - WITH_OPTIONAL_DEPS=yes - - WITH_OPTIONAL_DEPS=no +matrix: + include: + - python: "2.6" + env: WITH_OPTIONAL_DEPS=no TEST_SPHINX=no + - python: "2.6" + env: WITH_OPTIONAL_DEPS=yes TEST_SPHINX=no + - python: "2.7_with_system_site_packages" + env: WITH_OPTIONAL_DEPS=no TEST_SPHINX=no + - python: "2.7_with_system_site_packages" + env: WITH_OPTIONAL_DEPS=yes TEST_SPHINX=yes install: - testsuite/install.sh - pip install -e . diff --git a/testsuite/Testsrc/test_doc.py b/testsuite/Testsrc/test_doc.py new file mode 100644 index 000000000..93c8d1bb4 --- /dev/null +++ b/testsuite/Testsrc/test_doc.py @@ -0,0 +1,39 @@ +import os +import sys + +# add all parent testsuite directories to sys.path to allow (most) +# relative imports in python 2.4 +_path = os.path.dirname(__file__) +while _path != '/': + if os.path.basename(_path).lower().startswith("test"): + sys.path.append(_path) + if os.path.basename(_path) == "testsuite": + break + _path = os.path.dirname(_path) +from common import * + + +try: + from sphinx.application import Sphinx + HAS_SPHINX = True +except ImportError: + HAS_SPHINX = False + + +TEST_SPHINX = bool(os.environ.get('TEST_SPHINX', 'yes') != 'no') + + +class DocTest(Bcfg2TestCase): + top = os.path.join(os.path.dirname(__file__), '..', '..') + source_dir = os.path.join(top, 'doc/') + doctree_dir = os.path.join(top, 'build', 'doctree') + + @skipUnless(HAS_SPHINX, 'Sphinx not found') + @skipUnless(TEST_SPHINX, 'Documentation testing disabled') + def test_html_documentation(self): + output_dir = os.path.join(self.top, 'build', 'html') + + app = Sphinx(self.source_dir, self.source_dir, output_dir, + self.doctree_dir, buildername='html', + warningiserror=True) + app.build(force_all=True) |