From 4aaa975fbc9a747ff0d3e6bf8980f30824497b07 Mon Sep 17 00:00:00 2001 From: Mike Kell Date: Fri, 13 Jun 2025 01:58:34 +0000 Subject: [PATCH] test: add src to pythonpath for pytest --- .forgejo/workflows/ci.yaml | 17 +++++++++++------ Makefile | 6 +++++- pytest.ini | 2 ++ src/__init__.py | 0 4 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 pytest.ini create mode 100644 src/__init__.py diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 63fcf3c..48f7cae 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -5,17 +5,22 @@ jobs: runs-on: podman steps: - uses: actions/checkout@v4 - - - name: Run pre-commit checks + - name: Setup Python run: | pip install pre-commit pre-commit run --all-files - - name: Build FastAPI image run: | podman build -t cmmc-fastapi:${{ forgejo.sha }} \ -f .container-images/fastapi.Dockerfile . - # optional push to internal registry: - # - name: Push image - # run: podman push cmmc-fastapi:${{ forgejo.sha }} /:${{ forgejo.sha }} + tests: + runs-on: podman + needs: lint-build + steps: + - uses: actions/checkout@v4 + - name: Install test deps + run: | + pip install -r requirements.txt -r requirements-dev.txt + - name: Run pytest + run: pytest -q diff --git a/Makefile b/Makefile index 4141314..ec631b1 100644 --- a/Makefile +++ b/Makefile @@ -12,4 +12,8 @@ logs: ## follow logs build: ## build FastAPI image locally podman build -t cmmc-fastapi:latest -f .container-images/fastapi.Dockerfile . -.PHONY: up down logs build +test: ## run pytest quietly + pytest -q + + +.PHONY: up down logs build test diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..a635c5c --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +pythonpath = . diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e69de29