mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-13 16:34:52 +03:00
Add option to use behave-django.
This commit is contained in:
parent
bb6320efc8
commit
45105d2bc7
|
@ -33,6 +33,7 @@
|
|||
"GCP",
|
||||
"None"
|
||||
],
|
||||
"use_behave_django": "n",
|
||||
"custom_bootstrap_compilation": "n",
|
||||
"use_compressor": "n",
|
||||
"use_celery": "n",
|
||||
|
|
|
@ -279,6 +279,10 @@ def remove_node_dockerfile():
|
|||
shutil.rmtree(os.path.join("compose", "local", "node"))
|
||||
|
||||
|
||||
def remove_behave_django_files():
|
||||
shutil.rmtree('features')
|
||||
|
||||
|
||||
def main():
|
||||
debug = "{{ cookiecutter.debug }}".lower() == "y"
|
||||
|
||||
|
@ -342,6 +346,9 @@ def main():
|
|||
if "{{ cookiecutter.use_travisci }}".lower() == "n":
|
||||
remove_dottravisyml_file()
|
||||
|
||||
if "{{ cookiecutter.use_behave_django }}".lower() == "n":
|
||||
remove_behave_django_files()
|
||||
|
||||
print(SUCCESS + "Project initialized, keep up the good work!" + TERMINATOR)
|
||||
|
||||
|
||||
|
|
|
@ -292,7 +292,12 @@ ACCOUNT_EMAIL_VERIFICATION = "mandatory"
|
|||
ACCOUNT_ADAPTER = "{{cookiecutter.project_slug}}.users.adapters.AccountAdapter"
|
||||
# https://django-allauth.readthedocs.io/en/latest/configuration.html
|
||||
SOCIALACCOUNT_ADAPTER = "{{cookiecutter.project_slug}}.users.adapters.SocialAccountAdapter"
|
||||
|
||||
{% if cookiecutter.use_behave_django == 'y' -%}
|
||||
# django-behave
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://behave-django.readthedocs.io
|
||||
INSTALLED_APPS +=["behave_django"]
|
||||
{%- endif%}
|
||||
{% if cookiecutter.use_compressor == 'y' -%}
|
||||
# django-compressor
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
Feature: showing off behave
|
||||
|
||||
Scenario: run a simple test
|
||||
Given we have behave installed
|
||||
When we implement a test
|
||||
Then behave will test it for us!
|
27
{{cookiecutter.project_slug}}/features/steps/my_feature.py
Normal file
27
{{cookiecutter.project_slug}}/features/steps/my_feature.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
from behave import *
|
||||
|
||||
use_step_matcher("re")
|
||||
|
||||
|
||||
@given("we have behave installed")
|
||||
def step_impl(context):
|
||||
"""
|
||||
:type context: behave.runner.Context
|
||||
"""
|
||||
raise NotImplementedError(u'STEP: Given we have behave installed')
|
||||
|
||||
|
||||
@when("we implement a test")
|
||||
def step_impl(context):
|
||||
"""
|
||||
:type context: behave.runner.Context
|
||||
"""
|
||||
raise NotImplementedError(u'STEP: When we implement a test')
|
||||
|
||||
|
||||
@then("behave will test it for us!")
|
||||
def step_impl(context):
|
||||
"""
|
||||
:type context: behave.runner.Context
|
||||
"""
|
||||
raise NotImplementedError(u'STEP: Then behave will test it for us!')
|
|
@ -14,7 +14,9 @@ psycopg2-binary==2.8.3 # https://github.com/psycopg/psycopg2
|
|||
mypy==0.720 # https://github.com/python/mypy
|
||||
pytest==5.1.2 # https://github.com/pytest-dev/pytest
|
||||
pytest-sugar==0.9.2 # https://github.com/Frozenball/pytest-sugar
|
||||
|
||||
{%- if cookiecutter.use_behave_django == 'y' %}
|
||||
behave-django==1.3.0 #https://github.com/behave/behave-django
|
||||
{%- endif %}
|
||||
# Code quality
|
||||
# ------------------------------------------------------------------------------
|
||||
flake8==3.7.8 # https://github.com/PyCQA/flake8
|
||||
|
|
Loading…
Reference in New Issue
Block a user