Skip to content

Commit

Permalink
refactor makefile, add xdist
Browse files Browse the repository at this point in the history
  • Loading branch information
hnthh committed Nov 29, 2023
1 parent c17676c commit bec4e7d
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 7 deletions.
5 changes: 3 additions & 2 deletions hooks/post_gen_project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

rm -rf .mypy_cache \
.pytest_cache \
.venv
.venv \
db.sqlite

cp src/core/.env.ci src/core/.env

Expand All @@ -12,4 +13,4 @@ poetry run python src/manage.py collectstatic
poetry run python src/manage.py migrate
poetry run python src/manage.py startapp test_app

make lint test
make checks test
10 changes: 6 additions & 4 deletions {{cookiecutter.name}}/Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
manage = poetry run src/manage.py
numprocesses = 4

fmt:
poetry run autoflake --in-place --remove-all-unused-imports --recursive src tests
poetry run isort src tests
poetry run black src tests

lint:
checks:
$(manage) check
$(manage) makemigrations --check --dry-run --no-input

poetry run isort --check-only src tests
poetry run black --check src tests
poetry run flake8 src tests
poetry run mypy src tests
poetry run dotenv-linter src/core/.env.ci

test:
$(manage) makemigrations --dry-run --no-input --check
poetry run pytest --dead-fixtures
poetry run pytest -x
poetry run pytest --create-db --exitfirst --numprocesses ${numprocesses}

pr: fmt lint test
pr: fmt checks test
36 changes: 35 additions & 1 deletion {{cookiecutter.name}}/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions {{cookiecutter.name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pytest-env = "^1.1.1"
pytest-freezegun = "^0.4.2"
pytest-mock = "^3.12.0"
pytest-randomly = "^3.15.0"
pytest-xdist = "^3.5.0"
types-freezegun = "^1.1.10"
types-pillow = "^10.1.0.2"

Expand Down

0 comments on commit bec4e7d

Please sign in to comment.