mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-09 22:44:54 +03:00
Test black compliance for all possible options
This commit is contained in:
parent
61f531b19c
commit
e9b18d0848
|
@ -4,6 +4,7 @@ binaryornot==0.4.4
|
||||||
|
|
||||||
# Code quality
|
# Code quality
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
black==19.3b0
|
||||||
flake8==3.7.6
|
flake8==3.7.6
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
|
|
|
@ -119,6 +119,45 @@ def test_flake8_compliance(
|
||||||
pytest.fail(e)
|
pytest.fail(e)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("windows", BINARY_CHOICES)
|
||||||
|
@pytest.mark.parametrize("use_docker", BINARY_CHOICES)
|
||||||
|
@pytest.mark.parametrize("use_celery", BINARY_CHOICES)
|
||||||
|
@pytest.mark.parametrize("use_mailhog", BINARY_CHOICES)
|
||||||
|
@pytest.mark.parametrize("use_sentry", BINARY_CHOICES)
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
# These 2 cannot be used together, but test the other combinations
|
||||||
|
["use_compressor", "use_whitenoise"],
|
||||||
|
[("y", "n"), ("n", "n"), ("n", "n")],
|
||||||
|
)
|
||||||
|
def test_black_compliance(
|
||||||
|
cookies,
|
||||||
|
windows,
|
||||||
|
use_docker,
|
||||||
|
use_celery,
|
||||||
|
use_mailhog,
|
||||||
|
use_sentry,
|
||||||
|
use_compressor,
|
||||||
|
use_whitenoise,
|
||||||
|
):
|
||||||
|
"""Generated project should pass black"""
|
||||||
|
result = cookies.bake(
|
||||||
|
extra_context={
|
||||||
|
"windows": windows,
|
||||||
|
"use_docker": use_docker,
|
||||||
|
"use_compressor": use_compressor,
|
||||||
|
"use_celery": use_celery,
|
||||||
|
"use_mailhog": use_mailhog,
|
||||||
|
"use_sentry": use_sentry,
|
||||||
|
"use_whitenoise": use_whitenoise,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
sh.black("--check", "--diff", "--exclude", "migrations", f"{result.project}/")
|
||||||
|
except sh.ErrorReturnCode as e:
|
||||||
|
pytest.fail(e)
|
||||||
|
|
||||||
|
|
||||||
def test_travis_invokes_pytest(cookies, context):
|
def test_travis_invokes_pytest(cookies, context):
|
||||||
context.update({"use_travisci": "y"})
|
context.update({"use_travisci": "y"})
|
||||||
result = cookies.bake(extra_context=context)
|
result = cookies.bake(extra_context=context)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user