test: add src to pythonpath for pytest

This commit is contained in:
Mike Kell 2025-06-13 01:58:34 +00:00
parent 591bf68420
commit 4aaa975fbc
4 changed files with 18 additions and 7 deletions

View File

@ -5,17 +5,22 @@ jobs:
runs-on: podman runs-on: podman
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Setup Python
- name: Run pre-commit checks
run: | run: |
pip install pre-commit pip install pre-commit
pre-commit run --all-files pre-commit run --all-files
- name: Build FastAPI image - name: Build FastAPI image
run: | run: |
podman build -t cmmc-fastapi:${{ forgejo.sha }} \ podman build -t cmmc-fastapi:${{ forgejo.sha }} \
-f .container-images/fastapi.Dockerfile . -f .container-images/fastapi.Dockerfile .
# optional push to internal registry: tests:
# - name: Push image runs-on: podman
# run: podman push cmmc-fastapi:${{ forgejo.sha }} <registry>/<path>:${{ forgejo.sha }} 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

View File

@ -12,4 +12,8 @@ logs: ## follow logs
build: ## build FastAPI image locally build: ## build FastAPI image locally
podman build -t cmmc-fastapi:latest -f .container-images/fastapi.Dockerfile . 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

2
pytest.ini Normal file
View File

@ -0,0 +1,2 @@
[pytest]
pythonpath = .

0
src/__init__.py Normal file
View File