Skip to content

Commit

Permalink
add coverage, mypy packages and update makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
alsyx committed Oct 21, 2024
1 parent 9409a25 commit b7bb340
Show file tree
Hide file tree
Showing 4 changed files with 238 additions and 79 deletions.
2 changes: 1 addition & 1 deletion config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

DEBUG = False

ALLOWED_HOSTS = []
ALLOWED_HOSTS: list[str]


# Application definition
Expand Down
15 changes: 15 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,30 @@ check-black: # Run black with `--check` flag
check-isort: # Run isort with `--check` flag
poetry run isort --check .

check-mypy: # Run mypy
poetry run mypy .

check: # Run project checks
make check-black
make check-isort
make check-mypy
make check-migrations

# Tests
test: # Run pytest, use the optional arg `tests` to run specific tests, eg: `make test tests=path/to/test.py::ClassName::test_func_name`
$(web) pytest $(tests)

test-fresh: # The same as `make test` but with a fresh db
$(web) pytest --create-db $(tests)

coverage: # Run test with pytest and generate coverage report
$(web) coverage run -m pytest --create-db $(tests)
$(web) coverage report --fail-under=75

coverage-html: # Generate a html report of the test coverage
$(web) coverage html
poetry run python -m webbrowser htmlcov/index.html

# DB
db-reset: # Reset the database
docker compose stop postgres
Expand Down
Loading

0 comments on commit b7bb340

Please sign in to comment.