diff --git a/tests/test_cookiecutter_generation.py b/tests/test_cookiecutter_generation.py index d53019e9..0e36e83a 100755 --- a/tests/test_cookiecutter_generation.py +++ b/tests/test_cookiecutter_generation.py @@ -281,3 +281,20 @@ def test_error_if_incompatible(cookies, context, invalid_context): assert result.exit_code != 0 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 diff --git a/{{cookiecutter.project_slug}}/docs/index.rst b/{{cookiecutter.project_slug}}/docs/index.rst index 5fafc696..cb4cbaed 100644 --- a/{{cookiecutter.project_slug}}/docs/index.rst +++ b/{{cookiecutter.project_slug}}/docs/index.rst @@ -10,8 +10,8 @@ Welcome to {{ cookiecutter.project_name }}'s documentation! :maxdepth: 2 :caption: Contents: - howto - pycharm/configuration + howto{% if cookiecutter.use_pycharm == 'y' %} + pycharm/configuration{% endif %} users