Ejemplo n.º 1
0
 def test__build__mkdocs__none(self):
     os.environ['DOCUMENTATION_FORMATS'] = 'mkdocs'
     os.environ['DOCUMENTATION_PUBLISH'] = 'False'
     sys.argv = ['sdv4_documentation']
     with tempfile.TemporaryDirectory() as tempdir:
         os.chdir(tempdir)
         cli.main()
Ejemplo n.º 2
0
    def test__build__mkdocs(self):
        os.environ['DOCUMENTATION_FORMATS'] = 'mkdocs'
        os.environ['DOCUMENTATION_PUBLISH'] = 'False'
        sys.argv = ['sdv4_documentation']
        with tempfile.TemporaryDirectory() as tempdir:
            os.chdir(tempdir)
            os.makedirs('docs')
            with open('mkdocs.yml', 'w') as fh:
                fh.write('site_name: test\n')

            with open('docs/index.md', 'w') as fh:
                fh.write('# Title\n')
            cli.main()
Ejemplo n.º 3
0
    def test__publish__mkdocs__fail(self):
        os.environ['DOCUMENTATION_FORMATS'] = 'mkdocs'
        os.environ['DOCUMENTATION_PUBLISH'] = 'True'
        sys.argv = ['sdv4_documentation']
        with tempfile.TemporaryDirectory() as tempdir:
            os.chdir(tempdir)
            os.makedirs('docs')
            with open('mkdocs.yml', 'w') as fh:
                fh.write('site_name: test\nstrict: true\nnav:\n    - foo: bar.md\n')

            with open('docs/index.md', 'w') as fh:
                fh.write('# Title\n[bad_link](bar.md)\n')
            result = cli.main()
            self.assertNotEqual(result, 0)
Ejemplo n.º 4
0
    def test__build__sphinx(self):
        os.environ['DOCUMENTATION_DEBUG'] = 'True'
        os.environ['DOCUMENTATION_FORMATS'] = 'sphinx'
        os.environ['DOCUMENTATION_PUBLISH'] = 'False'
        sys.argv = ['sdv4_documentation']
        with tempfile.TemporaryDirectory() as tempdir:
            os.chdir(tempdir)
            os.makedirs('doc/source')
            with open('doc/source/conf.py', 'w') as fh:
                fh.write("""# -*- coding: utf-8 -*-
import os
extensions = []
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = 'foo'
copyright = ''
version = '0.0.0'
release = version
""")
            with open('doc/source/index.rst', 'w') as fh:
                fh.write('''Title\n-----\n\n''')

            cli.main()
Ejemplo n.º 5
0
    def test__build__mkdocs_venv__requirements_present(self):
        os.environ['DOCUMENTATION_FORMATS'] = 'mkdocs_venv'
        os.environ['DOCUMENTATION_PUBLISH'] = 'False'
        sys.argv = ['sdv4_documentation']
        with tempfile.TemporaryDirectory() as tempdir:
            os.chdir(tempdir)
            os.makedirs('docs')
            with open('mkdocs.yml', 'w') as fh:
                fh.write('site_name: test\nmarkdown_extensions:\n    - pymdownx.arithmatex\n')

            with open('docs/index.md', 'w') as fh:
                fh.write('# Title\n')

            with open('documentation_mkdocs_requirements.txt', 'w') as fh:
                fh.write('mkdocs\npymdown-extensions\n')

            result = cli.main()
        self.assertEqual(result, 0)
Ejemplo n.º 6
0
 def test__default__base(self):
     os.environ['DOCUMENTATION_FORMATS'] = 'base'
     sys.argv = ['sdv4_documentation']
     cli.main()