mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-10 19:57:09 +03:00
Relax rules for linting of pull requests on this template (#4273)
* Don't check for black or pre-commit by default Fix #4261 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Ignore CONTRIBUTORS.md when running template's pre-commit * Fix condition for skipping tests --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
009ce5e0b4
commit
550f270b70
|
@ -1,4 +1,4 @@
|
||||||
exclude: "{{cookiecutter.project_slug}}|.github/contributors.json|CHANGELOG.md"
|
exclude: "{{cookiecutter.project_slug}}|.github/contributors.json|CHANGELOG.md|CONTRIBUTORS.md"
|
||||||
default_stages: [commit]
|
default_stages: [commit]
|
||||||
|
|
||||||
repos:
|
repos:
|
||||||
|
|
|
@ -20,12 +20,6 @@ sudo utility/install_os_dependencies.sh install
|
||||||
# Install Python deps
|
# Install Python deps
|
||||||
pip install -r requirements/local.txt
|
pip install -r requirements/local.txt
|
||||||
|
|
||||||
# Lint by running pre-commit on all files
|
|
||||||
# Needs a git repo to find the project root
|
|
||||||
git init
|
|
||||||
git add .
|
|
||||||
pre-commit run --show-diff-on-failure -a
|
|
||||||
|
|
||||||
# run the project's tests
|
# run the project's tests
|
||||||
pytest
|
pytest
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,11 @@ if sys.platform.startswith("win"):
|
||||||
elif sys.platform.startswith("darwin") and os.getenv("CI"):
|
elif sys.platform.startswith("darwin") and os.getenv("CI"):
|
||||||
pytest.skip("skipping slow macOS tests on CI", allow_module_level=True)
|
pytest.skip("skipping slow macOS tests on CI", allow_module_level=True)
|
||||||
|
|
||||||
|
# Run auto-fixable styles checks - skipped on CI by default. These can be fixed
|
||||||
|
# automatically by running pre-commit after generation however they are tedious
|
||||||
|
# to fix in the template, so we don't insist too much in fixing them.
|
||||||
|
AUTOFIXABLE_STYLES = os.getenv("AUTOFIXABLE_STYLES") == 1
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def context():
|
def context():
|
||||||
|
@ -184,9 +189,10 @@ def test_flake8_passes(cookies, context_override):
|
||||||
pytest.fail(e.stdout.decode())
|
pytest.fail(e.stdout.decode())
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(not AUTOFIXABLE_STYLES, reason="Black is auto-fixable")
|
||||||
@pytest.mark.parametrize("context_override", SUPPORTED_COMBINATIONS, ids=_fixture_id)
|
@pytest.mark.parametrize("context_override", SUPPORTED_COMBINATIONS, ids=_fixture_id)
|
||||||
def test_black_passes(cookies, context_override):
|
def test_black_passes(cookies, context_override):
|
||||||
"""Generated project should pass black."""
|
"""Check whether generated project passes black style."""
|
||||||
result = cookies.bake(extra_context=context_override)
|
result = cookies.bake(extra_context=context_override)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -14,13 +14,6 @@ cd .cache/docker
|
||||||
cookiecutter ../../ --no-input --overwrite-if-exists use_docker=y "$@"
|
cookiecutter ../../ --no-input --overwrite-if-exists use_docker=y "$@"
|
||||||
cd my_awesome_project
|
cd my_awesome_project
|
||||||
|
|
||||||
# Lint by running pre-commit on all files
|
|
||||||
# Needs a git repo to find the project root
|
|
||||||
# We don't have git inside Docker, so run it outside
|
|
||||||
git init
|
|
||||||
git add .
|
|
||||||
pre-commit run --show-diff-on-failure -a
|
|
||||||
|
|
||||||
# make sure all images build
|
# make sure all images build
|
||||||
docker-compose -f local.yml build
|
docker-compose -f local.yml build
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user