From c14542f0a20b95e83eb8de38f7a470bd882f4ee3 Mon Sep 17 00:00:00 2001 From: Chris Holdgraf Date: Tue, 1 Aug 2017 00:05:46 -0400 Subject: [PATCH] adding doc generation from the tests --- docs/source/conf.py | 25 +++++++++++++++++++++++++ docs/source/index.rst | 5 +++++ tests/conda/requirements/README.rst | 5 +++++ tests/conda/simple/README.rst | 5 +++++ tests/julia/pyplot/README.rst | 5 +++++ 5 files changed, 45 insertions(+) create mode 100644 tests/conda/requirements/README.rst create mode 100644 tests/conda/simple/README.rst create mode 100644 tests/julia/pyplot/README.rst diff --git a/docs/source/conf.py b/docs/source/conf.py index 4fa1a8ff..ac9ce6b5 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -183,3 +183,28 @@ epub_copyright = copyright # A list of files that should not be packed into the epub file. epub_exclude_files = ['search.html'] + +# Build the repo2docker test syntax +from glob import glob +import os +s = '' +for folder, _, files in os.walk(os.path.join('..', '..', 'tests')): + if 'README.rst' not in files: + continue + header = files.pop(files.index('README.rst')) + with open(os.path.join(folder, header), 'r') as ff: + s += ff.read() + '\n' + for ifile in files: + filename = os.path.basename(ifile) + if filename == 'verify': + continue + with open(os.path.join(folder, ifile), 'r') as ff: + lines = ff.readlines() + lines = [' ' + line for line in lines] + this_s = '``{}``\n{}\n\n**Contents**::\n\n'.format( + filename, '~' * (len(filename) + 4)) + this_s += '\n'.join(lines) + this_s += '\n\n' + s += this_s +with open('./generated/test_file_text.txt', 'w') as ff: + ff.write(s) diff --git a/docs/source/index.rst b/docs/source/index.rst index 18c847b4..bafcd6a5 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -18,3 +18,8 @@ Indices and tables * :ref:`genindex` * :ref:`modindex` * :ref:`search` + +Build Syntax +============ + +.. include:: generated/test_file_text.txt diff --git a/tests/conda/requirements/README.rst b/tests/conda/requirements/README.rst new file mode 100644 index 00000000..336282f0 --- /dev/null +++ b/tests/conda/requirements/README.rst @@ -0,0 +1,5 @@ +Python - Mixed Requirements +--------------------------- + +You can specify both a ``requirements.txt`` and an ``environment.yml`` file, +and both of these will be used to build your environment. diff --git a/tests/conda/simple/README.rst b/tests/conda/simple/README.rst new file mode 100644 index 00000000..72b752ad --- /dev/null +++ b/tests/conda/simple/README.rst @@ -0,0 +1,5 @@ +Python - Conda Environment +-------------------------- + +Conda environments files may allow for more complex builds and dependencies. You +can specify them in the standard YAML structure. diff --git a/tests/julia/pyplot/README.rst b/tests/julia/pyplot/README.rst new file mode 100644 index 00000000..197c2a4c --- /dev/null +++ b/tests/julia/pyplot/README.rst @@ -0,0 +1,5 @@ +Julia - REQUIRE +--------------- + +The simplest way to specify dependencies in Julia, a REQUIRE file simply +lists the names of packages. Each one will be installed but not pre-compiled.