chore: split test and coverage tasks

This commit is contained in:
jo 2022-12-07 11:42:16 +01:00 committed by Kyle Robbertze
parent 33e13e877e
commit 5738edb49c
16 changed files with 37 additions and 21 deletions

View File

@ -73,7 +73,7 @@ jobs:
${{ matrix.release }}-pip-${{ inputs.context }} ${{ matrix.release }}-pip-${{ inputs.context }}
- name: Test - name: Test
run: make test run: make test-coverage
working-directory: ${{ inputs.context }} working-directory: ${{ inputs.context }}
- name: Report coverage - name: Report coverage

View File

@ -66,7 +66,7 @@ jobs:
${{ matrix.release }}-pip-api ${{ matrix.release }}-pip-api
- name: Test - name: Test
run: make test run: make test-coverage
working-directory: api working-directory: api
- name: Report coverage - name: Report coverage

View File

@ -8,7 +8,6 @@ PIP_INSTALL := \
PYLINT_ARG := libretime_analyzer tests || true PYLINT_ARG := libretime_analyzer tests || true
MYPY_ARG := libretime_analyzer tests || true MYPY_ARG := libretime_analyzer tests || true
BANDIT_ARG := libretime_analyzer || true BANDIT_ARG := libretime_analyzer || true
PYTEST_ARG := --cov=libretime_analyzer tests
format: .format format: .format
lint: .format-check .pylint .mypy .bandit lint: .format-check .pylint .mypy .bandit
@ -17,4 +16,5 @@ fixtures:
bash tests/fixtures/generate.sh bash tests/fixtures/generate.sh
test: fixtures .pytest test: fixtures .pytest
test-coverage: fixtures .coverage
clean: .clean clean: .clean

View File

@ -13,6 +13,9 @@ disable = "logging-fstring-interpolation"
log_cli = true log_cli = true
log_cli_level = "DEBUG" log_cli_level = "DEBUG"
[tool.coverage.run]
source = ["libretime_analyzer"]
[build-system] [build-system]
requires = ["setuptools", "wheel"] requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"

View File

@ -8,9 +8,9 @@ PIP_INSTALL := \
PYLINT_ARG := libretime_api_client tests || true PYLINT_ARG := libretime_api_client tests || true
MYPY_ARG := libretime_api_client tests || true MYPY_ARG := libretime_api_client tests || true
BANDIT_ARG := libretime_api_client || true BANDIT_ARG := libretime_api_client || true
PYTEST_ARG := --cov=libretime_api_client tests
format: .format format: .format
lint: .format-check .pylint .mypy .bandit lint: .format-check .pylint .mypy .bandit
test: .pytest test: .pytest
test-coverage: .coverage
clean: .clean clean: .clean

View File

@ -13,6 +13,9 @@ disable = "logging-fstring-interpolation"
log_cli = true log_cli = true
log_cli_level = "DEBUG" log_cli_level = "DEBUG"
[tool.coverage.run]
source = ["libretime_api_client"]
[build-system] [build-system]
requires = ["setuptools", "wheel"] requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"

View File

@ -13,18 +13,10 @@ export DJANGO_SETTINGS_MODULE=libretime_api.settings.testing
format: .format format: .format
lint: .format-check .pylint .mypy .bandit lint: .format-check .pylint .mypy .bandit
test: .pytest
test-coverage: .coverage
clean: .clean clean: .clean
test: $(VENV)
$(VENV)/bin/pytest -v \
--numprocesses=$(CPU_CORES) \
--color=yes \
--cov-config=pyproject.toml \
--cov-report=term \
--cov-report=xml:./coverage.xml \
--cov=libretime_api \
libretime_api
SCHEMA_FILE ?= schema.yml SCHEMA_FILE ?= schema.yml
schema: $(VENV) schema: $(VENV)
$(VENV)/bin/libretime-api spectacular --file $(SCHEMA_FILE) $(VENV)/bin/libretime-api spectacular --file $(SCHEMA_FILE)

View File

@ -36,7 +36,10 @@ log_cli_level = "DEBUG"
DJANGO_SETTINGS_MODULE = "libretime_api.settings.testing" DJANGO_SETTINGS_MODULE = "libretime_api.settings.testing"
[tool.coverage.run] [tool.coverage.run]
plugins = ["django_coverage_plugin"]
source = ["libretime_api"]
omit = [ omit = [
"*/migrations/*",
"*/tests/*", "*/tests/*",
] ]

View File

@ -35,6 +35,7 @@ setup(
"psycopg2>=2.8.6,<2.10", "psycopg2>=2.8.6,<2.10",
], ],
"dev": [ "dev": [
"django-coverage-plugin",
"django-stubs", "django-stubs",
"djangorestframework-stubs", "djangorestframework-stubs",
"model_bakery", "model_bakery",

View File

@ -10,11 +10,11 @@ PIP_INSTALL := \
PYLINT_ARG := libretime_playout tests || true PYLINT_ARG := libretime_playout tests || true
MYPY_ARG := libretime_playout tests || true MYPY_ARG := libretime_playout tests || true
BANDIT_ARG := libretime_playout || true BANDIT_ARG := libretime_playout || true
PYTEST_ARG := --cov=libretime_playout tests
format: .format format: .format
lint: .format-check .pylint .mypy .bandit lint: .format-check .pylint .mypy .bandit
test: .pytest test: .pytest
test-coverage: .coverage
clean: .clean clean: .clean
.PHONY: snapshot .PHONY: snapshot

View File

@ -16,6 +16,9 @@ disable = "logging-fstring-interpolation"
log_cli = true log_cli = true
log_cli_level = "DEBUG" log_cli_level = "DEBUG"
[tool.coverage.run]
source = ["libretime_playout"]
[build-system] [build-system]
requires = ["setuptools", "wheel"] requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"

View File

@ -6,9 +6,9 @@ PIP_INSTALL = --editable .[dev]
PYLINT_ARG = libretime_shared tests PYLINT_ARG = libretime_shared tests
MYPY_ARG = libretime_shared MYPY_ARG = libretime_shared
BANDIT_ARG := libretime_shared BANDIT_ARG := libretime_shared
PYTEST_ARG = --cov=libretime_shared tests
format: .format format: .format
lint: .format-check .pylint .mypy .bandit lint: .format-check .pylint .mypy .bandit
test: .pytest test: .pytest
test-coverage: .coverage
clean: .clean clean: .clean

View File

@ -19,6 +19,9 @@ disallow_untyped_defs= true
log_cli = true log_cli = true
log_cli_level = "DEBUG" log_cli_level = "DEBUG"
[tool.coverage.run]
source = ["libretime_shared"]
[build-system] [build-system]
requires = ["setuptools", "wheel"] requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"

View File

@ -55,13 +55,18 @@ install: $(VENV)
.PHONY: .pytest .PHONY: .pytest
.pytest: $(VENV) .pytest: $(VENV)
$(VENV)/bin/pytest -v \ $(VENV)/bin/pytest \
--numprocesses=$(CPU_CORES) \ --numprocesses=$(CPU_CORES) \
--color=yes \ --color=yes
.PHONY: .coverage
.coverage: $(VENV)
$(VENV)/bin/pytest \
--numprocesses=$(CPU_CORES) \
--cov \
--cov-config=pyproject.toml \ --cov-config=pyproject.toml \
--cov-report=term \ --cov-report=term \
--cov-report=xml:./coverage.xml \ --cov-report=xml
$(PYTEST_ARG)
.PHONY: .clean .PHONY: .clean
.clean: .clean:

View File

@ -8,9 +8,9 @@ PIP_INSTALL := \
PYLINT_ARG := libretime_worker PYLINT_ARG := libretime_worker
MYPY_ARG := libretime_worker || true MYPY_ARG := libretime_worker || true
BANDIT_ARG := libretime_worker BANDIT_ARG := libretime_worker
PYTEST_ARG = --cov=libretime_worker tests
format: .format format: .format
lint: .format-check .pylint .mypy .bandit lint: .format-check .pylint .mypy .bandit
test: .pytest test: .pytest
test-coverage: .coverage
clean: .clean clean: .clean

View File

@ -13,6 +13,9 @@ disable = "logging-fstring-interpolation"
log_cli = true log_cli = true
log_cli_level = "DEBUG" log_cli_level = "DEBUG"
[tool.coverage.run]
source = ["libretime_worker"]
[build-system] [build-system]
requires = ["setuptools", "wheel"] requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"