test_sphinx.py 672 B

1234567891011121314151617181920
  1. from __future__ import absolute_import, unicode_literals
  2. import pkg_resources
  3. import pytest
  4. try:
  5. sphinx_build = pkg_resources.load_entry_point(
  6. 'sphinx', 'console_scripts', 'sphinx-build')
  7. except pkg_resources.DistributionNotFound:
  8. sphinx_build = None
  9. @pytest.mark.skipif(sphinx_build is None, reason='Sphinx is not installed')
  10. def test_sphinx(tmpdir):
  11. srcdir = pkg_resources.resource_filename(__name__, 'proj')
  12. sphinx_build([srcdir, str(tmpdir)])
  13. with open(tmpdir / 'contents.html', 'r') as f:
  14. contents = f.read()
  15. assert 'This task has a docstring!' in contents
  16. assert 'This task is in a different module!' not in contents