本文整理汇总了Python中vilya.models.sphinx_docs.SphinxDocs类的典型用法代码示例。如果您正苦于以下问题:Python SphinxDocs类的具体用法?Python SphinxDocs怎么用?Python SphinxDocs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SphinxDocs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_html_and_raw_builders_in_different_dirs
def test_html_and_raw_builders_in_different_dirs(self):
prj = self._prj()
base_yaml_conf_two_builders = """
docs:
html:
dir: html_docs
builder: html
raw:
builder: raw
dir: pages
"""
self._add(prj, 'code_config.yaml', base_yaml_conf_two_builders)
self._add(prj, 'html_docs/index.rst', base_index_rst)
self._add(prj, 'html_docs/doc1.rst', base_document1_rst)
self._add(prj, 'pages/index.html', self.html1)
sd = SphinxDocs(prj.name)
sd.build_all()
assert sd.builders == ['html', 'raw']
raw_builder = sd.get_builder('raw')
doc = raw_builder.raw_content('index.html', {})
assert doc == self.html1
html_builder = sd.get_builder('html')
assert not html_builder.template
raw = html_builder.raw_content('index.html', {})
assert "<h1>Unit testing sphinx docs" in raw
开发者ID:leeccong,项目名称:code,代码行数:25,代码来源:test_sphinx_docs.py
示例2: test_two_builders_with_other_config_fmt
def test_two_builders_with_other_config_fmt(self):
prj = self._prj()
base_yaml_conf_two_builders = """
#sphinx_docs:
# dir: "docs"
# builders:
# - html:
# html_theme: default
# html_short_title: testsub
# dir: html_docs
# - raw:
# dir: pages
docs:
docs:
builder: html
html_theme: default
html_short_title: testsub
dir: html_docs
pages:
builder: raw
"""
self._add(prj, 'code_config.yaml', base_yaml_conf_two_builders)
self._add(prj, 'html_docs/index.rst', base_index_rst)
self._add(prj, 'html_docs/doc1.rst', base_document1_rst)
self._add(prj, 'pages/index.html', self.html1)
sd = SphinxDocs(prj.name)
sd.build_all()
assert sd.builders == ['docs', 'pages'] # noqa Sorted alphabetically by default
raw_builder = sd.get_builder('pages')
doc = raw_builder.raw_content('index.html', {})
assert doc == self.html1
html_builder = sd.get_builder('docs')
assert not html_builder.template
raw = html_builder.raw_content('index.html', {})
assert "<h1>Unit testing sphinx docs" in raw
开发者ID:leeccong,项目名称:code,代码行数:35,代码来源:test_sphinx_docs.py
示例3: test_create_with_index_and_doc_and_two_builders
def test_create_with_index_and_doc_and_two_builders(self):
prj = self._prj()
base_yaml_conf_two_builders = """
docs:
html:
dir: ''
builder: html
pickle:
dir: ''
builder: pickle
"""
self._add(prj, 'code_config.yaml', base_yaml_conf_two_builders)
self._add(prj, 'index.rst', base_index_rst)
self._add(prj, 'doc1.rst', base_document1_rst)
sd = SphinxDocs(prj.name)
sd.build_all()
assert sd.builders == ['html', 'pickle']
pickle_builder = sd.get_builder('pickle')
assert pickle_builder.template
doc = pickle_builder.template_data('', {})
assert doc['title'] == 'Unit testing sphinx docs'
html_builder = sd.get_builder('html')
assert not html_builder.template
raw = html_builder.raw_content('index.html', {})
assert "<h1>Unit testing sphinx docs" in raw
开发者ID:leeccong,项目名称:code,代码行数:25,代码来源:test_sphinx_docs.py
示例4: test_create_with_index_and_doc_and_two_builders
def test_create_with_index_and_doc_and_two_builders(self):
prj = self._prj()
base_yaml_conf_two_builders = """
docs:
docs:
builder: html
dir: ""
html_theme: default
html_short_title: testsub
docs2:
dir: ""
builder: pickle
"""
self._add(prj, "code_config.yaml", base_yaml_conf_two_builders)
self._add(prj, "index.rst", base_index_rst)
self._add(prj, "doc1.rst", base_document1_rst)
sd = SphinxDocs(prj.name)
sd.build_all()
assert sd.builders == ["docs", "docs2"]
pickle_builder = sd.get_builder("docs2")
assert pickle_builder.template
doc = pickle_builder.template_data("", {})
assert doc["title"] == "Unit testing sphinx docs"
html_builder = sd.get_builder("docs")
assert not html_builder.template
raw = html_builder.raw_content("index.html", {})
assert "<h1>Unit testing sphinx docs" in raw
开发者ID:sdgdsffdsfff,项目名称:code-1,代码行数:27,代码来源:test_docs.py
示例5: test_html_and_raw_builders_in_different_dirs
def test_html_and_raw_builders_in_different_dirs(self):
prj = self._prj()
base_yaml_conf_two_builders = """
docs:
docs:
builder: html
html_short_title: testsub
dir: html_docs
html_theme: default
pages:
builder: raw
dir: pages
"""
self._add(prj, "code_config.yaml", base_yaml_conf_two_builders)
self._add(prj, "html_docs/index.rst", base_index_rst)
self._add(prj, "html_docs/doc1.rst", base_document1_rst)
self._add(prj, "pages/index.html", self.html1)
sd = SphinxDocs(prj.name)
sd.build_all()
assert sd.builders == ["docs", "pages"]
raw_builder = sd.get_builder("pages")
doc = raw_builder.raw_content("index.html", {})
assert doc == self.html1
html_builder = sd.get_builder("docs")
assert not html_builder.template
raw = html_builder.raw_content("index.html", {})
assert "<h1>Unit testing sphinx docs" in raw
开发者ID:sdgdsffdsfff,项目名称:code-1,代码行数:27,代码来源:test_docs.py
示例6: test_build_info
def test_build_info(self):
prj = self._prj()
self._add(prj, 'docs/index.rst', base_index_rst)
self._add(prj, 'docs/doc1.rst', base_document1_rst)
sd = SphinxDocs(prj.name)
sd.build_all()
bi = sd.last_build_info()
assert bi['status'] == 'success'
开发者ID:leeccong,项目名称:code,代码行数:8,代码来源:test_sphinx_docs.py
示例7: test_create_with_index_and_doc
def test_create_with_index_and_doc(self):
prj = self._prj()
self._add(prj, 'docs/index.rst', base_index_rst)
self._add(prj, 'docs/doc1.rst', base_document1_rst)
sd = SphinxDocs(prj.name)
sd.build_all()
builder = sd.get_builder()
doc = builder.template_data('', {})
assert doc['title'] == 'Unit testing sphinx docs'
开发者ID:leeccong,项目名称:code,代码行数:9,代码来源:test_sphinx_docs.py
示例8: check_sphinx_builds
def check_sphinx_builds():
for proj in get_origin_projects():
try:
docs = SphinxDocs(proj.name)
except JagareError:
continue
if not docs.enabled or not docs.need_rebuild():
continue
sphinx_builds_add(docs)
开发者ID:leeccong,项目名称:code,代码行数:9,代码来源:tasks.py
示例9: test_pages_no_docsdir
def test_pages_no_docsdir(self):
prj = self._prj()
self._add(prj, "code_config.yaml", self.conf)
self._add(prj, "pagesNOT_THE_SAME/index.html", self.html1)
sd = SphinxDocs(prj.name)
sd.build_all()
assert sd.last_build_info()["status"] == "no_doc_dir_found"
builder = sd.get_builder(sd.builders[0])
assert builder.raw_content("index.html", {}) is False
开发者ID:sdgdsffdsfff,项目名称:code-1,代码行数:9,代码来源:test_docs.py
示例10: test_get_url_from_path_percent_sign_path
def test_get_url_from_path_percent_sign_path(self):
prj = self._prj()
sd = SphinxDocs(prj.name)
path = 'docs/doubanlib%2Fsqlstore.rst'
url = sd.get_url_from_path(path)
assert url == 'docs/rstdocs/doubanlib%252Fsqlstore/'
path = 'docs/%E6%80%A7%E8%83%BD%E6%B5%8B%E8%AF%95.rst'
url = sd.get_url_from_path(path)
assert url == 'docs/rstdocs/%25E6%2580%25A7%25E8%2583%25BD%25E6%25B5%258B%25E8%25AF%2595/' # noqa
开发者ID:leeccong,项目名称:code,代码行数:9,代码来源:test_sphinx_docs.py
示例11: test_build_info
def test_build_info(self):
prj = self._prj()
self._add(prj, "code_config.yaml", base_yaml_conf)
self._add(prj, "index.rst", base_index_rst)
self._add(prj, "doc1.rst", base_document1_rst)
sd = SphinxDocs(prj.name)
sd.build_all()
bi = sd.last_build_info()
assert bi["status"] == "success"
开发者ID:sdgdsffdsfff,项目名称:code-1,代码行数:9,代码来源:test_docs.py
示例12: test_use_autodoc_not_configured
def test_use_autodoc_not_configured(self):
prj = self._prj()
self._add(prj, 'docs/conf.py', self.conf_py)
self._add(prj, 'docs/index.rst', self.index_rst)
self._add(prj, 'testapi.py', self.api_py)
sd = SphinxDocs(prj.name)
sd.build_all()
builder = sd.get_builder()
doc = builder.template_data('', {})
assert "Test C docstring" not in doc['body']
开发者ID:leeccong,项目名称:code,代码行数:10,代码来源:test_sphinx_docs.py
示例13: test_create_with_index_and_doc
def test_create_with_index_and_doc(self):
prj = self._prj()
self._add(prj, "code_config.yaml", base_yaml_conf)
self._add(prj, "index.rst", base_index_rst)
self._add(prj, "doc1.rst", base_document1_rst)
sd = SphinxDocs(prj.name)
sd.build_all()
builder = sd.get_builder("docs")
doc = builder.template_data("", {})
assert doc["title"] == "Unit testing sphinx docs"
开发者ID:sdgdsffdsfff,项目名称:code-1,代码行数:10,代码来源:test_docs.py
示例14: test_create_with_index_and_doc_and_conf_py
def test_create_with_index_and_doc_and_conf_py(self):
conf_content = """rst_epilog = 'Ahhhhhhhhhhhhhhhh la fin' """
prj = self._prj()
self._add(prj, 'docs/index.rst', base_index_rst)
self._add(prj, 'docs/doc1.rst', base_document1_rst)
self._add(prj, 'docs/conf.py', conf_content)
sd = SphinxDocs(prj.name)
sd.build_all()
builder = sd.get_builder()
doc = builder.template_data('', {})
assert 'Ahhhhhhhhhhhhhhhh' in doc['body']
开发者ID:leeccong,项目名称:code,代码行数:11,代码来源:test_sphinx_docs.py
示例15: pages
def pages(self, request):
user = request.user
docs = SphinxDocs(self.proj_name)
tdt = {
'project': CodeDoubanProject.get_by_name(self.proj_name),
'request': request,
'user': user,
'docs': docs,
'last_build': docs.last_build_info(),
}
return st('settings/pages.html', **tdt)
开发者ID:000fan000,项目名称:code,代码行数:11,代码来源:settings.py
示例16: test_need_rebuild
def test_need_rebuild(self):
prj = self._prj()
self._add(prj, 'docs/index.rst', base_index_rst)
sd = SphinxDocs(prj.name)
assert sd.need_rebuild()
sd.build_all()
assert not sd.need_rebuild()
self._add(prj, 'docs/doc1.rst', base_document1_rst)
sd = SphinxDocs(prj.name) # Bad, should not have to refresh object
assert sd.need_rebuild()
sd.build_all()
assert not sd.need_rebuild()
开发者ID:leeccong,项目名称:code,代码行数:12,代码来源:test_sphinx_docs.py
示例17: test_create_with_index_and_doc_and_get_again
def test_create_with_index_and_doc_and_get_again(self):
prj = self._prj()
self._add(prj, 'code_config.yaml', base_yaml_conf)
self._add(prj, 'index.rst', base_index_rst)
self._add(prj, 'doc1.rst', base_document1_rst)
sd = SphinxDocs(prj.name)
sd.build_all()
sd2 = SphinxDocs(prj.name)
builder = sd2.get_builder()
assert builder.template
doc = builder.template_data('', {})
assert doc['title'] == 'Unit testing sphinx docs'
开发者ID:leeccong,项目名称:code,代码行数:12,代码来源:test_sphinx_docs.py
示例18: test_need_rebuild
def test_need_rebuild(self):
prj = self._prj()
self._add(prj, "code_config.yaml", base_yaml_conf)
self._add(prj, "index.rst", base_index_rst)
sd = SphinxDocs(prj.name)
assert sd.need_rebuild()
sd.build_all()
assert not sd.need_rebuild()
self._add(prj, "doc1.rst", base_document1_rst)
sd = SphinxDocs(prj.name) # Bad, should not have to refresh object
assert sd.need_rebuild()
sd.build_all()
assert not sd.need_rebuild()
开发者ID:sdgdsffdsfff,项目名称:code-1,代码行数:13,代码来源:test_docs.py
示例19: test_get_url_from_path_sphinx_doc_raw_builder_no_subdir
def test_get_url_from_path_sphinx_doc_raw_builder_no_subdir(self):
prj = self._prj()
base_yaml_conf_two_builders = """
docs:
mydocs:
dir: mydocsdir/3
builder: raw
"""
self._add(prj, 'code_config.yaml', base_yaml_conf_two_builders)
sd = SphinxDocs(prj.name)
path = 'mydocsdir/3/foo.bar'
url = sd.get_url_from_path(path)
assert url == 'docs/mydocs/foo.bar'
开发者ID:leeccong,项目名称:code,代码行数:13,代码来源:test_sphinx_docs.py
示例20: test_get_url_from_path_sphinx_doc_builder_pickle_subdir
def test_get_url_from_path_sphinx_doc_builder_pickle_subdir(self):
prj = self._prj()
base_yaml_conf_two_builders = """
docs:
mydocs:
dir: mydocsdir
pages:
builder: raw
"""
self._add(prj, 'code_config.yaml', base_yaml_conf_two_builders)
sd = SphinxDocs(prj.name)
path = 'mydocsdir/subdir/doc1.rst'
url = sd.get_url_from_path(path)
assert url == 'docs/mydocs/subdir/doc1/'
开发者ID:leeccong,项目名称:code,代码行数:14,代码来源:test_sphinx_docs.py
注:本文中的vilya.models.sphinx_docs.SphinxDocs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论