Skip to content

Updated Tests

Updated Tests #386

Workflow file for this run

name: Pytest
on:
pull_request:
paths:
- "**.py"
- "requirements.txt"
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_db
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres -d test_db"
--health-interval=10s
--health-timeout=5s
--health-retries=3
strategy:
matrix:
python-version: ["3.12.4"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Wait for PostgreSQL to be ready
run: |
while ! pg_isready -h localhost -p 5432 -U postgres -d test_db; do
echo "Waiting for PostgreSQL..."
sleep 2
done
- name: Set up the Database
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/test_db
run: |
python db_init.py create
- name: Running pytest
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/test_db
run: |
python -m pytest tests/