From 0ca3a25488ad156782cf77bd8f1ae5977dad94be Mon Sep 17 00:00:00 2001 From: Vadim Yaskshigulov Date: Thu, 26 Oct 2023 23:00:03 +0300 Subject: [PATCH] ci: add testing --- ...run-linters.yaml => run-code-quality-checks.yaml} | 8 +++++--- Makefile | 12 ++++++++---- pyproject.toml | 1 + tests/test_dummy.py | 2 ++ 4 files changed, 16 insertions(+), 7 deletions(-) rename .github/workflows/{run-linters.yaml => run-code-quality-checks.yaml} (76%) create mode 100644 tests/test_dummy.py diff --git a/.github/workflows/run-linters.yaml b/.github/workflows/run-code-quality-checks.yaml similarity index 76% rename from .github/workflows/run-linters.yaml rename to .github/workflows/run-code-quality-checks.yaml index c7b425c1..7d811f65 100644 --- a/.github/workflows/run-linters.yaml +++ b/.github/workflows/run-code-quality-checks.yaml @@ -1,10 +1,9 @@ -name: Check +name: Basics checks for code quality on: pull_request: branches: - main push: - jobs: lint: runs-on: ubuntu-latest @@ -21,4 +20,7 @@ jobs: run: python3 -m pip install poetry && make init - name: Run all linters and formatters - run: make lint \ No newline at end of file + run: make lint + + - name: Run all tests and count coverage + run: make test \ No newline at end of file diff --git a/Makefile b/Makefile index b7f307cb..a557a3e6 100644 --- a/Makefile +++ b/Makefile @@ -36,11 +36,15 @@ run: all: make init run +## Run all formatters and linters in project lint: - poetry run ruff ./tests ./app - poetry run ruff format --check ./tests ./app - poetry run black --check ./tests ./app - poetry run mypy --ignore-missing-imports ./app + poetry run ruff ./tests/*.py ./app/*.py + poetry run ruff format --check ./tests/*.py ./app/*.py + poetry run black --check ./tests/*.py ./app/*.py + poetry run mypy --ignore-missing-imports ./app/*.py +## Run all tests in project +test: + poetry run pytest --verbosity=2 --showlocals -log-level=DEBUG --cov=app --cov-report term .DEFAULT_GOAL := help # See for explanation. diff --git a/pyproject.toml b/pyproject.toml index 8b2d8b16..bcecd03b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,7 @@ black = "^23.10.1" pre-commit = "^3.5.0" celery-types = "^0.20.0" watchdog = "^3.0.0" +pytest-cov = "^4.1.0" [build-system] requires = ["poetry-core"] diff --git a/tests/test_dummy.py b/tests/test_dummy.py new file mode 100644 index 00000000..2907fadd --- /dev/null +++ b/tests/test_dummy.py @@ -0,0 +1,2 @@ +def test_true_is_true(): + assert True is True