Merge pull request #3139 from fhightower/patch-1

Removing pycharm docs if app does not use pycharm
This commit is contained in:
Bruno Alla 2021-09-11 17:55:10 +01:00 committed by GitHub
commit 57f9ff571b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View File

@ -281,3 +281,20 @@ def test_error_if_incompatible(cookies, context, invalid_context):
assert result.exit_code != 0 assert result.exit_code != 0
assert isinstance(result.exception, FailedHookException) assert isinstance(result.exception, FailedHookException)
@pytest.mark.parametrize(
["use_pycharm", "pycharm_docs_exist"],
[
("n", False),
("y", True),
],
)
def test_pycharm_docs_removed(cookies, context, use_pycharm, pycharm_docs_exist):
"""."""
context.update({"use_pycharm": use_pycharm})
result = cookies.bake(extra_context=context)
with open(f"{result.project}/docs/index.rst", "r") as f:
has_pycharm_docs = "pycharm/configuration" in f.read()
assert has_pycharm_docs is pycharm_docs_exist

View File

@ -10,8 +10,8 @@ Welcome to {{ cookiecutter.project_name }}'s documentation!
:maxdepth: 2 :maxdepth: 2
:caption: Contents: :caption: Contents:
howto howto{% if cookiecutter.use_pycharm == 'y' %}
pycharm/configuration pycharm/configuration{% endif %}
users users