diff --git a/tests/pyexample/conf.py b/tests/pyexample/conf.py new file mode 100644 index 0000000..71485a7 --- /dev/null +++ b/tests/pyexample/conf.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- + +templates_path = ['_templates'] +source_suffix = '.rst' +master_doc = 'index' +project = u'pyexample' +copyright = u'2015, rtfd' +author = u'rtfd' +version = '0.1' +release = '0.1' +language = None +exclude_patterns = ['_build'] +pygments_style = 'sphinx' +todo_include_todos = False +html_theme = 'alabaster' +html_static_path = ['_static'] +htmlhelp_basename = 'pyexampledoc' +extensions = ['autoapi.extension'] +autoapi_type = 'python' +autoapi_dir = 'example' +autoapi_file_pattern = '*.py' \ No newline at end of file diff --git a/tests/pyexample/example/example.py b/tests/pyexample/example/example.py new file mode 100644 index 0000000..0b4d2dd --- /dev/null +++ b/tests/pyexample/example/example.py @@ -0,0 +1,7 @@ +__author__ = 'swenson' + +import math + +def example_function(x): + """Compute the square root of x and return it.""" + return math.sqrt(x) \ No newline at end of file diff --git a/tests/pyexample/index.rst b/tests/pyexample/index.rst new file mode 100644 index 0000000..e3395cc --- /dev/null +++ b/tests/pyexample/index.rst @@ -0,0 +1,26 @@ +.. pyexample documentation master file, created by + sphinx-quickstart on Fri May 29 13:34:37 2015. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to pyexample's documentation! +===================================== + +.. toctree:: + + autoapi/index + +Contents: + +.. toctree:: + :maxdepth: 2 + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/tests/test_python_full.py b/tests/test_python_full.py new file mode 100644 index 0000000..0739c4d --- /dev/null +++ b/tests/test_python_full.py @@ -0,0 +1,33 @@ +__author__ = 'swenson' + +import os +import shutil +import subprocess as sp +import unittest + + +class FullPythonTests(unittest.TestCase): + + def test_full_run(self): + os.chdir('tests/pyexample') + try: + if os.path.exists('_build'): + shutil.rmtree('_build') + os.mkdir('_build') + sp.check_call('sphinx-build -b text -d ./doctrees . _build/text', shell=True) + + with open('_build/text/autoapi/example/index.txt') as fin: + text = fin.read().strip() + self.assertEquals(text, '''example +******* + + +Function +======== + + example.example_function() + + Compute the square root of x and return it.''') + + finally: + os.chdir('../..')