예제 #1
0
def test_autobuild_with_options(mock_makedirs, mock_watch, mock_builder,
                                mock_serve, mock_schedule):
    """
    Test autobuild entry point with host, ignore, and watch options
    """
    main()
    mock_makedirs.assert_called_once_with('/output')

    # --port, --host
    mock_serve.assert_called_once_with(host='example.org',
                                       root='/output',
                                       port=8888)

    # --ignore
    mock_builder.assert_called_once_with('/output', ['/source', '/output'],
                                         ['/ignored'], DEFAULT_IGNORE_REGEX)

    # --watch
    calls = [
        call('/source', mock_builder.return_value),
        call('/external', mock_builder.return_value),
        call('/output')
    ]
    for call_spec in mock_watch.call_args_list:
        assert call_spec in calls
예제 #2
0
def test_autobuild(mock_makedirs, mock_serve, mock_schedule):
    """
    Test autobuild entry point.
    """
    main()
    mock_makedirs.assert_called_once_with('/output')
    mock_serve.assert_called_once_with(
        host='127.0.0.1', root='/output', port=8000)
예제 #3
0
def main():
    ensure_in_environ_PATH(get_python_script_path())

    sys.argv = [
        'sphinx-autobuild',
        './source',
        './build/html_live',
        '--port',
        '8000',
        '--watch',
        '..',
    ]
    sphinx_autobuild.main()
예제 #4
0
def auto_build_docs(workspace_dir: str, out_dir: str, extra_args):
    import sphinx_autobuild
    with _prepare_source_tree(workspace_dir) as temp_src_dir:
        os.chdir(temp_src_dir)
        sys.argv = [
            sys.argv[0],
            '.',
            out_dir,
            '-i',
            'python/api/*.rst',
            '--poll',
        ] + extra_args
        sphinx_autobuild.main()
예제 #5
0
def main():
  _this_path = os.path.dirname(__file__)
  python_path = os.path.dirname(sys.executable)
  python_script_path = os.path.join(python_path, r'Scripts')
  env_path = os.environ.get('PATH')
  if python_script_path not in env_path:
    print("Adding Python script path")
    os.environ['PATH'] = env_path + f";{python_script_path}"
  sys.argv = [
    'sphinx-autobuild', '.', './_build/html_live',
    '--port', '8003',
    '--watch', '..',
  ]
  sphinx_autobuild.main()
예제 #6
0
def test_autobuild_with_options(mock_makedirs,
                                mock_watch, mock_builder,
                                mock_serve, mock_schedule):
    """
    Test autobuild entry point with host, ignore, and watch options
    """
    main()
    mock_makedirs.assert_called_once_with('/output')

    # --port, --host
    mock_serve.assert_called_once_with(
        host='example.org', root='/output', port=8888)

    # --ignore
    mock_builder.assert_called_once_with(
        '/output', ['/source', '/output'], ['/ignored'], DEFAULT_IGNORE_REGEX)

    # --watch
    calls = [call('/source', mock_builder.return_value),
             call('/external', mock_builder.return_value),
             call('/output')]
    for call_spec in mock_watch.call_args_list:
        assert call_spec in calls
예제 #7
0
#!/root/anaconda3/bin/python
# coding:utf-8
from __future__ import absolute_import, unicode_literals
from sphinx_autobuild import main
import re
import sys

__author__ = "golden"
__date__ = '2017/8/11'

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.argv += ['-p', '8001']
    sys.exit(main())