From 8f7855fbbb4f3de1e5e51e7106ccab0e6260b523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Bournhonesque?= Date: Fri, 9 Feb 2024 13:35:54 +0100 Subject: [PATCH] chore: add unit and integration test checks --- .github/workflows/quality-check.yml | 42 +++++++++++++++++++++++++++++ Makefile | 2 ++ tests/integration/test_api.py | 1 + 3 files changed, 45 insertions(+) create mode 100644 .github/workflows/quality-check.yml diff --git a/.github/workflows/quality-check.yml b/.github/workflows/quality-check.yml new file mode 100644 index 00000000..6f69c0ee --- /dev/null +++ b/.github/workflows/quality-check.yml @@ -0,0 +1,42 @@ +name: Open Prices unit and integration tests + +on: + push: + paths: + - "**/app/**" + - "pyproject.toml" + - "poetry.lock" + - "tests/**" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + unit-test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - "3.11" + + steps: + #---------------------------------------------- + # check-out repo + #---------------------------------------------- + - name: Check out repository + uses: actions/checkout@v3 + + #---------------------------------------------- + # Launch checks and tests + #---------------------------------------------- + - name: Configure docker + run: | + # ensure a new line for .env file might not have it! + echo "" >> .env + # align user id + echo "OFF_UID=$UID" >> .env + echo "PYTHON_VERSION=${{ matrix.python-version }}" >> .env + + - name: Launch tests + run: make tests diff --git a/Makefile b/Makefile index 4758a45f..1bc451db 100644 --- a/Makefile +++ b/Makefile @@ -125,6 +125,8 @@ docs: checks: toml-check flake8 black-check mypy isort-check docs +tests: unit-tests integration-tests + unit-tests: @echo "🥫 Running tests …" # change project name to run in isolation diff --git a/tests/integration/test_api.py b/tests/integration/test_api.py index 0a204f73..c2a7b2f3 100644 --- a/tests/integration/test_api.py +++ b/tests/integration/test_api.py @@ -25,6 +25,7 @@ def override_get_db(): db = session() yield db finally: + # close the DB session db.close()